R15 Animation for sleeping on a bed won't work?

I have a camp rp game and I was making an animation so when you touch the bed you lay down. But something does not seem to be working. The seat is not under any model/part, just the workspace.

https://www.roblox.com/library/9632574843/Sleeping

image

function added(child)
	if (child.className=="Weild") 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)
1 Like

On line 2 it should be

if (child.className=="Weld") then
1 Like

I don’t see a difference in that. Ohhhh I see it now.

1 Like

You put “Weild” instead it should be “Weld”

My animation still won’t play??

You don’t have seat definined, put this at the very top

local seat = script.Parent

Alright let me try this. Give me a second.

Not how I attended…
My legs should be straight

Sorry I haven’t responded in a while, I tried the script and it worked for me, are you getting any errors and can you send your current script.

You need to set your animation priority to Action.