In Minecraft 1.14.4, I and my friend want to make a custom map and we need to detect if there are at least 2 players online with command blocks.

Is there any way to do that?

  • @pppery That answer is outdated and uses testfor, and this person wants to know how to do it in 1.14. – cherryblossom Oct 20 at 5:17
  • 1
    @cherryblossom Questions with outdated answers to not cease to be valid duplicate targets. – pppery Oct 20 at 13:50

You can solve this problem using scoreboards. In an impulse command block put this command:

/scoreboard objectives add playercount dummy "playercounter"

Then connect 4 chain command blocks set to always active, in the first one put this command:

/execute as @a run scoreboard players add x playercount 1


/execute if score x playercount matches 2.. run *"your command here"*


/execute if score x playercount matches ..2 run tellraw @a {"text":"There are not enough players","color":"red"}


/scoreboard players reset x playercount

Not the answer you're looking for? Browse other questions tagged or ask your own question.