How would I be able to make it so when someone sits in a seat in your game, it makes them do a sit animation, that I made, until they get out of the seat? I made a sit animation, but I just can't figure out how to apply it to a player when they are sitting.
✓ ANSWER ACCEPTED
How can I make it so when someone sits in a seat, it applys an animation I made to them?
2 answers
✓ Accepted answer
The Humanoid Instance has an invisible property called HumanoidStateType, this tells you what the Humanoid is doing (Sitting, Running, Dead, Jumping, and more!) So you can write a function like this:
If your script is inside the seat:
local seat = script.Parent
function SeatIsSatIn(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local character = hit.Parent
local humanoid = character.Humanoid
wait(0.5) -- Wait a little bit so that the character has time to sit.
if humanoid:GetState() == Enum.HumanoidStateType.Seated then -- Make sure the humanoid is sitting
local animation = Instance.new("Animation")
animation.AnimationId = "http://www.roblox.com/asset/?id=182435998" -- Put your AnimationID here, currently Gangnam Style
local track = humanoid:LoadAnimation(animation)
track:Play()
local function StateChanged(oldState, newState)
if newState ~= Enum.HumanoidStateType.Seated then
track:Stop()
end
end
humanoid.StateChanged:connect(StateChanged)
end
end
end
seat.Touched:connect(SeatIsSatIn)
2 comments
0
@Unlimitus, I made this account just to say thanks! I really needed that script.
0
Strange. now its not working
Whenever you sit on a seat it applies a weld when you touch it, you'd probably have to make your own custom seat.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
you should be able to use a http://wiki.roblox.com/index.php?title=API:Class/Instance/Changed ened then ckeck the http://wiki.roblox.com/index.php?title=API:Class/Seat/Occupant