Death animation not playing

So im making a 2D game and I have spike hazards in the game that kill instantly the weird thing is when I walk into the spike it kills him and plays the death animation, but when I jump on the spike it just constantly plays the running animation but its as if he is dead, because input is disabled like normal.

You’re using an enum to set it to dead. Within your animation blueprint, you need to make sure that this “state” entry has an arrow from everything (Jumping has an arrow pointing to it, running, etc.). Every state within your state machine must have an entry arrow for dead (so when dead is set, it overrides everything).

Like @Omnicypher stated above me, it’s best to have the spike call the event on the player. There is a function called ApplyDamage. You call this function, and on the player, add an EventAnyDamage. From your EventAnyDamage, you can handle it how you want from there (basically what you are doing).

What you can do is call MontagePlay with a dying montage. You can set the dead state right after. When the montage ends (it overrides the animations in the state machine), it should jump to your “dead” animation.