2

So I am currently making a minecraft custom map (for 1.9). I want to make the player "say" something using /tellraw commands. I did figure out how to make the player name come up using /say commands, but still have no idea how to do it using the /tellraw command.

How do I do that?

  • Have you made any attempt to solve this yourself? Arqade works better when askers show effort to solve their own problems; we see that you have a problem you've worked on, and answerers respond to that. You also get a more specific answer that's tailored exactly to the part you're stuck, and Arqade gets a very specific question. Everybody wins! – Frank Mar 26 '16 at 13:43
  • I can try that... – MCMFan Mar 26 '16 at 13:44
2

You'll need to use selectors. These are things like @a, @p, etc. (Look at the link for adding things like scoreboard). To use this in /tellraw, use the following:

"extra":[{"selector":"@p"}]

So, let's say we want a command to say "Hi! My name is ..." Try this:

/tellraw @a {"text":"Hi! My name is ","extra":[{"selector":"@p"}]}

To break it down,

/tellraw @a                    @a means all, so this goes to everyone in the world

{"text":"Hi! My name is ",     The "text" part tells tellraw that the next part 
                               (denoted by :) in quotes is text to be displayed.

"extra":[{"selector":"@p"}]}   The "extra" tag says the next part is something 
                               extra (figures). Then, the "selector" tag says the 
                               next part is a selector, and "@p" means the nearest 
                               player from where the command is being run.

Probably More than You Need to Known, Just Putting it Here Anyways

To tell everyone in the world, use @a. To tell everyone with a score of 3 in the objective Kills, use

@a[score_Kills=3,score_Kills_min=3]

In English, it means "Anybody (@a) with a maximum score of 3 and a minimum score of 3". This may sound weird, but since the only number with a maximum of 3 and a minimum of 3 is, well, 3, that command only targets players with 3 as their Kills score.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.