Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Sit animation with roblox animation editor not working?

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.sitting)
			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)

I followed a tutorial for sit animation, it doesn't work. Basically whenever I sit in the seat, it doesn't play the animation. Someone help! (animation is R15)

1 answer

Use the Humanoid Seated event to know when a player is sitting. Here is an article link: Seated event

Example script:

local humanoid = player.Character.Humanoid
humanoid.Seated:Connect(function(isSeated) -- should always use Connect instead of connect
    if isSeated then
        -- play your animation
    end
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.