I'm on snapshot 15w41b by the way. So I set up a bunch of teams that I'm using as ranks in vanilla Minecraft, and then set up a row of command blocks that use the /testfor command that have comparators running from them to another command block that has the /scoreboard join command.

So it's like this: command block with /testfor @p[lm=30,l=49], and then a comparator running from it to another command block with /scoreboard teams join (team) @p[lm=30,l=49]. It works perfectly but only for one player; for some reason it won't add two players to the same team when they reach level 30. I also tried different selectors like @a and (player name) but they didn't work any better. Any help would be appreciated thanks!

1 Answer 1


First of all, let's talk about the mistake you are making:

Your testfor command output will be permanently on, as long as there is at least one player with 30 to 49 levels, meaning the scoreboard command will only be run if there was no player in that range and then there is.

Secondly, @p[something] will always target the player nearest to the execution position that qualifies for "something". You'll need to use @a in the team join command.

That said, lucky for you the testfor is completely unnecessary*. scoreboard can do the job perfectly fine on it's own.

/scoreboard teams join (team) @a[lm=30,l=49,team=!(team)]

The latter part of the command prevents people from being added to the same team multiple times. If there is no-one in that level range (or all of them are assigned a team already), the command will simply not add anyone to the team.

* In most cases, execute is strictly better than testfor

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .