Animation wont work after player respawns

For a combat system, I am currently working on a block system. Everything goes well until the player dies/respawns. When the player respawns Everything works except for the animation.

Im not sure how to fix this problem

Simply place the script inside of StarterCharacterScripts instead of StarterPlayerScripts

StarterCharacterScripts automatically reloads the script for you each time the character is spawned.


Xitral has the solution.

Adding on why Xitral is correct:
You load the Animation onto the character’s Humanoid. When the character gets destroyed, so does the Humanoid (the same one the animation was loaded onto).

I tried that, but then UserInputService wont work.

I also tried putting the animation in the server script. But the animation dosent stop in the server script.