Death animation play more than once

I have set my death animation wrapmode become once but it still play loop. How can I play it just once before destroyed ?

Your die() function is being called repeatedly during the two seconds before it is Destroyed. Add a boolean to indicate whether the animation can play again. Like so:

function die() {

	if (!isDead) {
		isDead = true;


The animation won’t play anymore after the first call because the boolean “isDead” is now true.

another way is:

if (health <= 0 && !isDead) {
     isDead = true;