So I created a custom sitting animation using the animation editor, basically when you sit on a couch im wanting it to lean you back and place your arms kinda to your sides and w/e.

So I made the animation for that but when you sit on the seat, the animation plays for like .2 seconds then it just goes to the normal sitting animation.

Code attached.

seat = script.Parent
function added(child)
	if (child.className=="Weld") then
		local 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)

5 comments

0

I would just change the players sitting animation and then change it back to the original in the function removed

0

I'm pretty sure that this isn't an issue with your code instead it's with the animate code inside the character, what you should try is to change the sitting animation by going to the animate script's children and go to the specific one that says sitting and change it to your animation id then change it back when the function is removed

0

:Destroy() please :Remove() is deprecated

0

change the animations priority in the editor to action

0

oh and make sure it's looping