How do I detect if a player sat on a seat and when the player leaves?
✓ ANSWER ACCEPTED
How to detect if seat is occupied or not?
1 answer
✓ Accepted answer
-- Server Script
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(Player) -- When a player joins
Player.CharacterAdded:Connect(function(Character) -- When the player spawns
local Humanoid = Character.Humanoid -- Retrieving the humanoid to get the SeatPart prop
Humanoid:GetPropertyChangedSignal('SeatPart'):Connect(function() -- When the SeatPart prop changes
if not Humanoid.SeatPart then
print('Player left seat')
else
print('Player sat')
end
end)
end)
end)
Hope this helps. Anything else you need make sure to ask me.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Great answer. Much more efficient than Seat.Occupant.