Death animation makes humanoid shake

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.

Have you tried removing the 0 from an:Play(0)?, according to documentation it defaults to 1.

Yes. That doesn’t do anything.

Also, I’m using a custom startercharacter but it’s just a modified standard R6 one.

Have you tried testing your script on an unmodified R6 character?

Yeah, doesn’t do anything, just shakes.

Bruuuh this was the problem

hum:SetStateEnabled(Enum.HumanoidStateType.Dead, true/false)