I am yet again needing some help with making my Minecraft: Hunger Games map and in order to teleport each player to their podium, I set up a group of 24 command blocks setting them to teleport each team to each podium, for example:

/tp @a[team=P1] x y z, /tp @a[team=P2] x y z

But what I need is something to automatically assign a person when they join the server to a team, but each person must join a different team and I mustn't have two people in the same team.
Any suggestions on how I may accomplish this?


I have needed something similar in the past. The downside is it isn't very compact as you need 1 command block per team. All you need is an impulse command block and chain command blocks.

The command you put in the command blocks is

/scoreboard teams join <team name> @r[team=]

The @r[team=] targets everyone who isn't on a team. Later when the game ends you can run the command

/scoreboard teams empty <team name>

to remove all players (offline and online) on that team.

  • So should I set up a ticker to activate them automatically or will that break it? – TheImatato Apr 21 '16 at 16:22
  • if you want the command running all the time then replace the impulse command block with a repeating command block. If I were to make it I'd have a lobby where everyone spawns in when they join then you only need to run the commands once when the game starts. One problem you would have if they automatically got assigned a team as soon as they joined would be if they left. There would be no easy way to detect that the person left the server and thus empty the team. – LethaIity Apr 21 '16 at 20:39

now we have repeating command blocks, so you can easily just constantly use what Lethality has said. If you'd want to do it for players who are in survival, just make the specification tag to be


m=0 specifies for players in survival, 1 would be creative, 2 for adventure, and 3 for spectator.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.