I want to make command block code that will testfor when there is only one player left on a score board team.

1 Answer 1


When a /testfor command is run, the command block's SuccessCount tag will be set equal to the number of entities that the selector found. You can then use a /testforblock command in another block to check whether the first command block's SuccessCount is a certain number.

For example:

/testfor @a[team=red]
/testforblock X Y Z command_block -1 {SuccessCount:1}

Change X Y Z in the second command block to the coordinates of the first command block. You may also need to change command_block to chain_command_block or repeating_command_block.

The second command will only succeed if the first command has a SuccessCount of 1 (it found exactly 1 player). You can then run a conditional chain block off of that second command to activate whatever you want to happen when there are exactly 1 player:



You must log in to answer this question.

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