Testfor Player Health 0 [closed]
I am trying to testfor @a health at 0 (when the player dies) using the /scoreboard command. The commands I was using do not seem to be working; the commandblock output is "cannot be found." I added an objective:
/scoreboard objectives add health health
And I added the testfor:
/testfor @p[score_health_min=0,score_health=0]
Yet this is brings up the error:
Entity '@p[score_health_min=0,score_health=0]' cannot be found.
How can this be done correctly?
While the above answer is valid, I believe this would be faster and more efficient.
scoreboard objectives add dieTime stat.timeSinceDeath
execute @a[score_dieTime=0] ~ ~ ~ say I am dead!