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?
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
___________________________Second__________________________________
/execute if score x playercount matches 2.. run *"your command here"*
____________________________Third________________________________
/execute if score x playercount matches ..2 run tellraw @a {"text":"There are not enough players","color":"red"}
_________________________Fourth__________________________________
/scoreboard players reset x playercount
testfor
, and this person wants to know how to do it in 1.14.