When an entity is killed and a score is assigned to that entity in the same tick, but after it was killed (using functions and @s), a scoreboard entry is created that can't be deleted easily. One would expect scoreboard entries of dead entities to be removed.
How to reproduce
Create a function with two commands:
kill @s
scoreboard players set @s <some_objective> 1Execute this function as some entity.
Inspect the scoreboard using the sidebar
Notice a scoreboard entry with the UUID of the entity that was killed by the function.
This behavior was not present before 1.17.
Comments 5
I encountered this in 1.19. This issue occurs when interacting with an entity's score after it’s dead. Doesn't quiet look like a bug. You can fix your function by using “scoreboard players reset [target]“ at the end.
Scoreboard entries of actual entities are usually never persistent past the entity's death. The only way for the "user“ to make persistent entries is by using an explicit score holder name in a command.
The fact that a score with the name being the uuid of the – now dead – holder remains clearly breaks this rule. The "user“ never created a score under that name and it can be almost impossible to reference these leftover scores.
I have not tried this in recent versions, we should investigate whether this bug re-appeared. If so, this would need to be re-opened.
I was unable to replicate with command blocks, so there's probably more to it than "in the same tick"