I need to run a command for @a
that doesn't have a score of 1. Is there a way to do that? (0 wont work because the default is no score, not 0). I would list my command but I'm not sure of the format. I want it to set all players without a score of 1 to /gamemode
Survival. Any suggestions?
Minecraft Java Edition – How to Test for Players Without a Score
minecraft-commandsminecraft-java-edition
Related Topic
- Minecraft-Java-Edition – How to Select Players That Do Not Have a Specific Score Set in Minecraft Commands
- Minecraft Java Edition – How to Test if a Player is Lagging on a Vanilla Server
- Minecraft Java Edition – Display Player Gamemode In-Game Using Commands
- Minecraft – Setting score to moving variable
- Minecraft Java Edition – Is There a Way to Test What Sounds Are Playing to a Player?
- Minecraft Java Edition – How to Detect a Player Holding Right Click in Minecraft 1.14.3
Best Answer
You cannot directly target somebody that has no score instantiated.
If you absolutely need to avoid any score except 1 (i.e. a score of 0 or lower, 2 or higher, or no score at all), you can label players that have a score of 1 and then target players without that label:
The benefit here is that no commands here are constantly running, as players that did match will no longer do so.
An alternative is to add 0 to their score in order to instantiate it with a default of 0, which will not change their score if they're already tracked:
The first
/scoreboard
command is always running, which may not be desirable.