So I’m making a death animation for my game, but it just refuses to work and shakes my character weirdly. Code:
local Players = game:GetService('Players')
Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
local hum = char:WaitForChild('Humanoid')
hum:SetStateEnabled(Enum.HumanoidStateType.Dead, false)
hum.Died:Connect(function()
char.HumanoidRootPart.Anchored = true
local an = hum:LoadAnimation(script.anim)
an:Play(0)
an.Stopped:Connect(function()
hum:SetStateEnabled(Enum.HumanoidStateType.Dead, true)
end)
end)
end)
end)
Video:
Also, nothing seems to be wrong with the animation, its unlooped and its priority is action.