P
Pop Storm Daily

How to set up teams with command blocks?

Author

Sophia Edwards

Published Jul 12, 2026

I am making a mini game in Minecraft where when you first spawn in you are in a lobby where there are two 2 3x2 caves, one blue, the other red. When someone walks into one of the caves it adds them to the blue or red team.

I am wanting to know how to

  1. Add someone to a team when they walk into one of the respective caves

  2. Set it so when they press start game it teleports the players to their respective bases, not to the same one

Finally, its going to be a game where you kill the other team's leader (a wolf or ocelot) but how can i keep them from moving around without a fence or barrier because they are the leader.

It would be easy to set up something that will check for players at X. example it would check for players at 93 9 20 then activate another command block.

1

1 Answer

The answers you are looking for can be found on the Minecraft Wiki entries for scoreboard and commands.

Setting up teams

To assign a player to a team you have to set up the teams first, using

/scoreboard teams add <team> [display name]
/scoreboard teams option <team> color <value>

<team> is the name of the team, e.g. red or blue. [display name] is an optional longer name, used in the scoreboard display, e.g. Team Ocelot or Team Jacob. The second command sets the team color, use [tab] after color to see your options, e.g. red, blue.

The command to assign someone to a team is

/scoreboard teams join <team> [players]

I suggest using simple pressure plates at the cave entrances, with the command blocks right below. You can then use @p fpr [players] to select the nearest player, who is normally the one that triggered the plate. Alternatively, you can use @a[r=X] to assign everyone in an X block radius sphere around the command block at once, or specify a block range with the selectors x, y, z, dx, dy and dz.

Teleport by team

To teleport every player on a specific team, you can use the @a selector with the team specifier, i.e.

/tp @a[team=<team>] <x> <y> <z>
7