Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do you check if a seat is occupied?

Hey! I have a seat, and a script, and I want something to happen when the seat becomes occupied. Any help would be apprieciated!

2 answers

✓ Accepted answer

Using :GetPropertyChangedSignal, what this should do is detect when a player is seated in a seat, and print something.

local seat = script.Parent --get the seat

seat:GetPropertyChangedSignal("Occupant"):Connect(function() --detect when the seat's occupancy has changed
	if seat.Occupant ~= nil then --check if the seat has become vacant or not
		print("Someone is sitting in the seat!") -- if not vacant, print this
	end
end)

1 comment

0

Thx! :D

You can try using this.

local Seat =  script.Parent -- Path to seat

Seat:GetPropertyChangedSignal("Occupant"):Connect(function()
	if Seat.Occupant ~= nil then
		print("something is happening")
	end
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.