When a scoreboard is created or reset it has no value but if it is enabled the value is set to 0.
This can lead to unintended behaviour since it is not what I expect.
How to reproduce:
/scoreboard objectives add test trigger
/scoreboard players enable @s test
/scoreboard players get @s test
Returns 0 instead of an error that the value is not set
Linked issues
Comments 2
Thank you for your report!
We're tracking this issue in MC-107049, so this ticket is being resolved and linked as a duplicate.
If you would like to add a vote and any extra information to the main ticket it would be appreciated.
If you haven't already, you might like to make use of the search feature to see if the issue has already been mentioned.
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki
-- I am a bot. This action was performed automatically! The ticket was resolved by one of our moderators, and I left this message to give more information to you.
This seems to be intentional, as the enabled state is saved to the score value object:
All entries in
PlayerScores
in scoreboard.dat have all values, even those without atrigger
objective haveLocked
.Additionally, this is the same behavior as using a non-initialized score in
/scoreboard players operation
, even the source score gets set to 0 if it isn't set.