I'm using Minecraft Java version 1.12.2.
I have a fake player called Alive that shows the amount of players still active inside the arena. When a player loses a round that counter will lower by 1. When the count reaches 1 the game will stop (don't worry about that; I already know how to handle this).
The problem I'm having with this is that I don't know how to tell a command block to keep an active count of the number of Alive players.

Does anyone know how to count players within a radius and set that for the score of the fake player Alive?

  • Wow, this seems to actually not be a duplicate, at least I was unable to find anything newer than 1.8. Feb 25, 2020 at 19:39

1 Answer 1


In 1.13+ this is fast and easy:

/execute store result score <target> <scoreboard> if entity @a

In 1.12.2 and before you need to increase a score once per player:

/execute @a ~ ~ ~ scoreboard players add <target> <scoreboard> 1

And before the next execution you always need to reset it:

/scoreboard players reset <target> <scoreboard>

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