Select player that does not have a specific score set
I want to select all players that do not have a specific scoreboard objective value set. I have tried doing testfor @a[score_hasJoined=]
and testfor @a[score_hasJoined_min=]
, but it still won't work. The hasJoined
objective is a dummy
objective, and therefore users do not start with 0
when they join.
I want to set all players' score without the score to 0
. I have thought that there maybe is an objective that automatically starts at 0
but I couldn't find one.
Solution 1:
The problem is that you can't target someone without a score using a score selector. So the solution, not surprisingly, is to give everyone a score. You don't have to change anyone's score value either; instead, just "increment" everyone's score by 0, in your case, with the following command:
/scoreboard players add @a hasJoined 0
Better yet, throw that command in a command block that is triggered off a 20Hz clock, and you're guaranteed that everyone always has a score.
The way this works is that everyone that already has a score in the hasJoined
objective won't have their score changed, but everyone else will have their hasJoined
score set to 0.