What am I doing wrong with this /testfor command?
Seems like my command wont work, can anyone help me? i spent more than 30 minutes on this 1 command and still wont work. i put the command in the command block and it lights up, even if there is only 1 player
Here's the command; what am Idoing wrong?
/testfor @e[team=Red,c=2]
Solution 1:
c=2
in 1.12 and limit=2
in 1.13 is a restriction to at most that many entities. So if there are 3 players, it would just select 2. But if there is only 1, it would find that one player.
To put the number of players on a team into a scoreboard called "playerCount", execute this command:
/execute store result score dummyPlayer playerCount if entity @e[team=Red]
You don't even need a run
and chained command, since execute if
without a chained command just gives back the number of matched entities.
dummyPlayer
is in this command, who would have thought, a dummy player. You can then run commands under the condition that it's higher than or equal to 2 like this:
/execute if score dummyPlayer test matches 2.. run <command>