Add tellraw command function to signs

minecraft-commandsminecraft-java-edition

I was trying to make a map where the signs are empty but talk in chat when you right-click them, but it keeps showing red in the command block and giving the error: Expected '}' at position 135 llraw @p "<–[HERE], this is my code /setblock ~ ~1 ~ oak_wall_sign[facing=south]{ Text1:"[{\"text\":\"\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"tellraw @p "Hello"\"}}]" }

Best Answer

UPDATE: The information about requiring JSON input is incorrect, however my answer still uses it. The correct command would be:

/give @p minecraft:oak_sign{BlockEntityTag:{Text1:'{"text":"Minecraft Tools","clickEvent":{"action":"run_command","value":"tellraw @a {\\"text\\": \\"Hello\\"}"}}'},display:{Name:'{"text":"Custom Sign"}'}}

which alternates single quotes and double quotes to avoid the nested quote problem

Original Answer

tellraw @p "Hello"

Tellraw commands accept JSON as their input, not raw text. I'd recommend first testing this on its own:

/tellraw @p {"text": "hello"}

This probably won't work on the sign though, my guess is you'll need:

/setblock ~ ~1 ~ oak_wall_sign[facing=south]{ Text1:"[{\"text\":\"\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"tellraw @p {\"text\": \"Hello\"}\"}}]" }

Or maybe even:

/setblock ~ ~1 ~ oak_wall_sign[facing=south]{ Text1:"[{\"text\":\"\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"tellraw @p {\\"text\\": \\"Hello\\"}\"}}]" }

Note the double backslashes.