1

I'm working on a map in Bedrock Edition, and I need to have a command block at the end that says "Congratulations [player], you win!" Because it's a map, I cant just have it say a specific player's name, and I've seen maps that do exactly what I want mine to do. How do I format the command to allow this?

1
  • This is relatively easy in the Java Edition, but I'm not sure how you would do it Pocket Edition, unless /tellraw uses the same JSON formatting.
    – MBraedley
    Commented Jun 19, 2019 at 11:51

1 Answer 1

4

You can do it with this command:

/say Congratulations @p, you win

You can use any other target selector if you prefer that, you can even use @a, or @e, which will return a list with all the specified players/entities, separated by ,.

This, for example, will say "Congratulations Pig, Pig, Pig, you win", if there are 3, or more pigs in your world and you haven´t renamed them:

/say Congratulations @e[type=pig,c=3], you win
1
  • 2
    Duh, why didn't I think of this?
    – MBraedley
    Commented Jun 19, 2019 at 16:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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