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?
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=]
@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.