How do I output a scoreboard value or a selector to chat in Bedrock Edition?
Solution 1:
As of November 17, 2020, this has been made possible with the 1.16.100 update. This update includes changes to command format, including the addition of selectors and scores to the Bedrock Edition /tellraw
command. These act the same as their Java Edition counterparts, meaning the commands that you know and love in Java Edition will be the same when they are added to Bedrock Edition.
Note that you need to change the raw JSON text format to be in BE syntax:
-
tellraw @a {"rawtext":[{"selector":"@p"},{"text":" has won the game!"}]}
-
tellraw @a {"rawtext":[{"text":"You have "},{"score":{"name":"*","objective":"lives"}},{"text":"lives left."}]}
Remember, while these new JSON features have been added to Bedrock Edition to make it more like Java Edition's ways, they are still not the same. The following items will still be different:
- Text formatting: Instead of using raw JSON text, use the section sign
§
with formatting codes. For example:{"text":"Test","bold":true}
→{"text":"§lTest"}
- No further changes have been made to allow NBT support. So unfortunately, you may not use raw JSON text in NBT tags, like items' custom names and lores, though you can mimic the
/give
command through a little extra work.