Minecraft – Select teams using /tellraw command

minecraft-commandsminecraft-java-edition

I would like to know if it possible to use teams with the tellraw command.

I know that you can use it to select players (e.g. /tellraw @a {"text":"","color":"blue","extra":[{"selector":"@p"},{"text":" has won the game!"}]}), but is it possible to do this for teams?

I'm using Minecraft version 1.15.2 and am in a Superflat world in Creative Mode.

Best Answer

Of course it's possible.

Just change the selector in the "selector" tag to change who is said in the message, or the selector at the start to change who the message is displayed to.

Examples:

/tellraw @a[team=teamA] [{"text":"Congratulations, Team A! You have won the game!"}]
DISPLAYS TO:   Everyone on team A.
MESSAGE READS: Congratulations, Team A! You have won the game!

Or:

/tellraw @a [{"text":"Congratulations, "}, {"selector":"@a[team=teamA]"}, {"text":"! You have won the game!"}]
DISPLAYS TO:   Everyone.
MESSAGE READS: Congratulations, ExpertCoder14, User2, and User3! You have won the game!