So im working on a system that checks if a seat is not taken, if its not taken the player will be seated on that seat this is what i came up with
local GameHandler = function()
local AssignSeats = function()
for i, Players in pairs(game.Players:GetPlayers()) do
if Players.Character then
print(Players.Character)
for i, Seat in pairs(workspace.Seats:GetChildren()) do
if Seat.Occupant == nil then
local RandomSeat = Seat[math.random(1, #Seat)]
print(RandomSeat)
end
end
end
end
end
while wait(5) do
AssignSeats()
end
end
return GameHandler
Error
ServerScriptService.GameHandler:8: attempt to get length of a Instance value - Server - GameHandler:8
23:40:20.815 Stack Begin -