How do I detect if more than 2 player are online with command blocks minecraft 1.14.4

by Johannes173   Last Updated October 19, 2019 22:14 PM

Me and my friend wants to make a custom map and we need to detect if there's atleast 2 players online with command blocks.

Is there any way to do that?

Tags : minecraft


Answers 1


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
Bloodbeast 234
Bloodbeast 234
October 20, 2019 09:44 AM

Related Questions


Updated November 26, 2017 06:14 AM

Updated March 16, 2019 12:14 PM

Updated December 27, 2017 04:14 AM

Updated August 20, 2019 13:14 PM