Hey! I have a seat, and a script, and I want something to happen when the seat becomes occupied. Any help would be apprieciated!
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)
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)