Hi, I make a script for when a player dies then all his animations stop, however the print on line 13 does not even get trough. What am i doing wrong?
game:GetService("Players").PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
repeat wait() until Character
local Humanoid = Character:WaitForChild("Humanoid")
local Animator = Humanoid:WaitForChild("Animator")
Humanoid.Died:Connect(function()
print("Died")
local AnimationTracks = Animator:GetPlayingAnimationTracks()
for _,Animation in pairs(AnimationTracks) do
Animation:Stop()
end
end)
end)
end)

1 comment
What's line 5 for? Feels like that's kind of unnecessary