So basically, when I sit down, it 70% of the time glitches and doesn't play the animation I assign it. Any help?

Edit: When I anchor the seat it doesn't play the animation and when I do have it unanchored, it plays. But the thing is I want the seat anchored so it doesn't go everywhere. I tried welding and that didn't work.

Code:

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=4758281323"
            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)