Im trying to make animated seats On Line 6 Im getting a error saying loadanimation requires an animation object In the seat I have this script and The sit animation

seat = script.Parent
function added(child)
	if (child.className == "Weld") then
		humanoid = child.part1.Parent:FindFirstChild("Humanoid")
		if humanoid ~= nil then
			anim = humanoid: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)

If anyone can help thanks.

2 comments

0

Is this a local script?

0

No Its just a normal script