Minecraft – How to detect if multiple players have the same scores

minecraft-commandsminecraft-java-edition

This is my command, it should only activate if all players have avance score on 0:

/execute if entity @a[scores={avance=0}]

I thought that with @a it would only be true if ALL players have that condition, but the command block output says "Test Passed, count 1"
and that screws up the whole circuit as it depends on the command output being "Test Passed" only when all players have the same score on 0 to work.

Best Answer

There are multiple solutions, the easiest is to check if no player does not fulfill the condition:

/execute unless entity @a[scores={avance=1..}] unless entity @a[scores={avance=..-1}]

You can also add limit=1 to both of these selectors to improve performance. Thanks to vdvman1 for this tip.