Seat animation broken

My seat animation is broken. What is wrong with the script?

seat = script.Parent
function added(child)
	if (child.className=="Weld") then
		human = child.part1.Parent:FindFirstChild("Humanoid")
		if human ~= nil then
			anim = human:LoadAnimation(seat.sitanim)
			anim:Play()
		end
	 end
end

function removed(child2)
	if anim ~= nil then
		anim:Stop()
		anim:Remove()
	end
end

seat.ChildAdded:connect(added)
seat.ChildRemoved:connect(removed)

Is seat.sitanim an animation object? What exactly is broken about the animation? Could you provide some images?
Also, from the look of your script, anim is a variable contained inside the functions only. Your reference to it in removed() won’t provide anything because it never existed. You should put local anim = nil or something along those lines outside of the functions at the top of the script

image

I want it to play the animation when I sit

Oh, I might be wrong, but I believe the default sitting animation is overriding yours. What priority is the animation you are trying to run? It could help to set it to the highest priority so that it can override the default animation script.

Either that or you can directly change the animation id inside the default animation script so that the default sitting animation can never be played at all

You want to make that animation in every seat? Or just in that one?