Im trying to make it so that when a player sits in a seat, a animation is applied to them.
local seat = script.Parent
function SeatIsSatIn(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local character = hit.Parent
local humanoid = character.Humanoid
wait(0.5)
if humanoid:GetState() == Enum.HumanoidStateType.Seated then
local animation = Instance.new("Animation")
animation.AnimationId = "http://www.roblox.com/asset/?id=182435998"
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)
I made this script a year ago when I was 8, it may not work, and it didnt..... Whats wrong with it. The script error finder on roblox didnt help me.

1 comment
It worked great, i had to alter it a bit though.