If Entity does not have a score in a scoreboard and is used with selector (@a,@p,@r,@e) it will not be successful.
Eg.
testfor @p[score_test=0] does not work if player has not been set to 0 already. or
testfor @a[score_test_min=10] but player has not been set or just logged into the world for first time it does not work
Linked issues
is duplicated by 2
relates to 1
Comments 17
What Luke means is if a player hasn't joined yet, their score wont register as being 0, and therefore will not be picked up by the command blocks. If they joined and were set to -1 first, then 0, it works as intended.
LTDR/Too rambly:
The game's default default score doesn't register players properly, and therefore can't be tracked unless added manually with quirky work arounds.
Reopened. Please provide exact steps to reproduce and edit the summary of this ticket appropriately.
/scoreboard objectives add playerID dummy
/scoreboard objectives add nextPlayerID dummy
/scoreboard players set DUMMYPLAYER nextPlayerID 1
Place a command block:
Fill it with: /scoreboard players operation @p[score_playerID=0] playerID += DUMMYPLAYER nextPlayerID
Place a comparator out of that command block.
Place a command block after the comparator:
Fill it with: /scoreboard players add DUMMY_PLAYER nextPlayerID 1
The problem lies in the fact that the selector "@p[score_playerID=0]" never selects a player to use the operation on. By default, any score is initialized as 0.
What should happen is, it will take the nearest player's "playerID score" and add the "nextPlayerID score" to it, as long as it's 0. Afterwards it adds 1 to the "nextPlayerID score" so it is always unique per cycle.
This doesn't work because of the selector fail.
This seems to happen either if the objective is new (added since 14w11a), or if the player is new - but I'm having a hard time recreating the issue, it seems to sometimes occur at random points; a player may have valid scores one login, but invalid scores the next[?]
It's notable that if you do a simple [EDITED]:
/scoreboard objectives add myObjective dummy
[should default all players to 0]
/say @a[score_myObjective_min=0]
[returns no players; expected all online players to be listed]
/say @a[score_myObjective=0]
[also returns no players; expected all online players to be listed]
You will find that the player(s) this may have affected will not show up for either /say, meaning they either have no score, or an invalid score in the scoreboard.
If I can find clearer steps to reproduce, I'll edit this post.
EDIT: Seems just creating brand-new objectives does the trick, but I don't know how this bug applies to previously-created objectives (even though it seems to have some effect).
ALSO:
This bug may be related to: https://bugs.mojang.com/browse/MC-50601
Ticket resolved as incomplete, because no answer in a reasonable amount of time (1+ year), if it still happens, please update the ticket.
Resolving as intended: It's illogical to be able to select an entity that isn't anywhere in existance.
The issue is that this used to be able to be done, but at some point 1.8 i think it was this ceased to be able to be done
score_test=0
selects all player having 0 or less pointsscore_test_min=10
selects all player 10 or more points