--The server will fire the ExitSeat remote to the client when the humanoid has been removed from a seat.
--This script listens to that and uses it to prevent the humanoid tripping when exiting a seat.
--As the player is removed from the seat server side, this scripts listens to the event instead of being
-- inside the ExitSeat function so that:
-- A) The timing is right - the exit seat function will run before the character is unsat by the server
-- B) If a server script removes the player from a seat, the anti-trip will still run

local function antiTrip()
	local humanoid = getLocalHumanoid()
	if humanoid then
		humanoid:ChangeState(Enum.HumanoidStateType.GettingUp)
	end
end
Remotes.ExitSeat.OnClientEvent:Connect(function(doAntiTrip)
	for _, func in pairs(module.OnExitFunctions) do
		func(nil)
	end
	if doAntiTrip then
		antiTrip()
	end
end)

return module
