Hello.
Is it possible to have one script that manages all of the seats in a folder.
Say if I have 4 seats in a folder called Seats in workspace, is there a way to create one script that can detect when the occupant value is changed in all 4 of the seats?
1 Like
Sure, you can Connect() multiple events to the same function.
If you have it working for a single seat, could you share that code?
I want to start coding all the seats, so have not started, but want to just use one script to manage them all.

I just want to be able to run one function, in one script, when Seat.Occupant is updated.
You can use a for loop to iterate through all of the seats:
local function onOccupantChanged(seat)
--//do stuff
end
for _, seat in ipairs(workspace.Seats:GetChildren()) do
seat:GetPropertyChangedSignal("Occupant"):Connect(function() onOccupantChanged(seat) end)
end
Minor edit:
seat:GetPropertyChangedSignal("Occupant"):Connect(function() onOccupantChanged(seat) end)
1 Like
Oopsies, thanks for pointing that out.