I wrote this script a few months ago to get the player into a pose when they sit on a seat. Now this script doesn't work anymore. How can I repair it ?

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)

2 comments

0

I'm quite confused with line:4, how did you get the Humanoid using Part1?

0

I copied the script from a video back then.