How to assign players in MC to a scoreboard team automatically when they join?

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?

  • What's the point of leveling up in Minecraft?
  • Can mobs use levers?
  • What's the difference between the Fancy and Fast settings in Minecraft?
  • Is there any way to reuse a boat?
  • Removing some hostile creatures in minecraft
  • How do I get minecraft heads from a specific player skin
  • How do I make the comparator work and then stop?
  • Can you now get villagers through zombie spawners?
  • New spawn rules for Minecraft 1.8
  • FTB Ultimate Server constantly giving “can't keep up!” errors
  • I can't connect to a friend's Minecraft server, but none of the usual culprits seem to be the problem
  • Adding Minecraft to Steam with 64bit JRE
  • 2 Solutions collect form web for “How to assign players in MC to a scoreboard team automatically when they join?”

    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.

    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.

    We love Playing Games, especially Video Games.