Help for an npc script on death destroy an animation


please help me I need the code corrected I want that when the npc has 0 of life the animation script ns is destroyed which is where is an animation that causes bug

script.parent.Humanoid.Died:Connect(function()
local Animations = (“Animations”)
if Animations then Animations:Destroy() end
end)

[image]

Hello! Destroying this animation object will not stop the animation, you need to loop through :GetPlayingAnimationTracks() on the humanoid you loaded the animation. You can search to see if the name matches the animation object’s name and stop it if so.

not what I want is that when dying the npc destroy the script with the animation