TransWikia.com

Launch command by clicking words at the chat

Arqade Asked by Forcelydated on January 10, 2021

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?

One Answer

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".

Correct answer by SMILIECHICKEN on January 10, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP