Have a seatcheck run on either seat but more reliably

so i have some code to run a function named seatCheck() and I was wondering if it was possible to condense it?

so here’s my code:

seat1:GetPropertyChangedSignal("Occupant"):Connect(function() 
	if seat1.Occupant then
		seatCheck()
	else
		seatCheck()
	end
end)

seat2:GetPropertyChangedSignal("Occupant"):Connect(function() 
	if seat2.Occupant then
		seatCheck()
	else
		seatCheck()
	end
end)

but i kinda want it to be like (pseudocode):

seat1:GPCS("Occupant"):Connect(function()...) or seat2:GPCS("Occupant"):Connect(function()...)

Also I have been suggested:

seat1:GetPropertyChangedSignal("Occupant"):Connect(seatCheck)
seat2:GetPropertyChangedSignal("Occupant"):Connect(seatCheck)

however this didn’t activate

Make a folder with all of the seats and do

local seatsFolder = workspace.Seats

for _, seat in seatsFolder:GetChildren() do
    if seat:IsA("Seat") then
        seat:GetPropertyChangedSignal("Occupant"):Connect(seatCheck)
    end
end
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.