/

/tellraw

op 2Text

/tellraw sends a raw JSON text component, which is the only way to get colours, hover tooltips and clickable links into chat. In 1.21.5 the event fields were renamed — clickEvent became click_event and hoverEvent became hover_event, with reshaped payloads, so the same message needs different JSON on either side of that version.

Commandready
14
/tellraw @p ""
Press C to copy
Nearest player
@p

Who or what the command applies to

Previewapproximate

Nothing to show yet

1

Examples

  • Coloured text
    /tellraw @a {"text":"Welcome!","color":"gold","bold":true}
  • Clickable command
    /tellraw @a {"text":"[Teleport]","color":"aqua","click_event":{"action":"run_command","command":"/spawn"}}
  • Show a score
    /tellraw @a ["Kills: ",{"score":{"name":"@s","objective":"kills"}}]

Common questions about /tellraw

Why does my tellraw work on 1.21.4 but not 1.21.5?

The event keys changed in 1.21.5. clickEvent became click_event and hoverEvent became hover_event; open_url now uses url instead of value, run_command uses command, and show_text takes value rather than contents. A component written for 1.21.4 will not work on 1.21.5 unless those keys are renamed.

Why is everything after my first bit of text the same colour?

In a JSON array, later elements inherit the formatting of the first. Start the array with an empty string, as in ["",{"text":"a"},{"text":"b"}], and every element gets a clean slate.

How do I show a player’s score in chat?

Add a score segment with the holder and objective. Use @s for whoever is receiving the message, or a fixed name for a shared value.

Can players click text to run a command as an operator?

No. run_command executes as the clicking player with their own permissions. For privileged actions, have it trigger a scoreboard trigger that a repeating command block acts on.