2

In the map I am currently working on, there is a part where the player can choose [Yes] / [No] from chat, where The [Yes] is in green and the [No] is in red. Then a command would be run when the player clicks on either the Yes or the No. Are there any commands that can do that?

3

You would use the /tellraw command to do this. Using the command:

/tellraw @p ["",{"text":"Yes ","color":"green","clickEvent":{"action":"run_command","value":"/tp @p x y z "}},{"text":"No","color":"red","clickEvent":{"action":"run_command","value":"/tp @p x y z "}}]

This would display text in chat "Yes No", where the Yes is green and the No is red. In the command where you see the first "/tp @p x y z" (does not need to be a tp command, of course) put whatever coordinates you want to tp the player to if they click on Yes. Do the same thing for the second "/tp @p x y z" for if they were to click on No. You are also able to add more text after or before the "Yes No".

  • Keep in mind that the clicking players must be OP'd on the server in order to use /tellraw clickEvents, and are also subject to a 100-character limit. To get around those, use the /trigger command, which can be used by non-OP's. – Skylinerw Dec 30 '15 at 15:10

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.