My script works fine as it is, but I keep getting this error:
ServerScriptService.RoundController:39: invalid argument #2 to ‘random’ (interval is empty)
This error corresponds with my player chosen variable. My full script is shown here:
for _,seat in ipairs(workspace.TableArea.Chairs.Seats:GetChildren()) do
if seat:IsA("Seat") and not seat.Occupant then -- if the seat is a seat and doesn't have anyone on it
local playerchosen = math.random(1,#players)
local chosenchar = workspace:FindFirstChild(players[playerchosen])
seat:Sit(chosenchar.Humanoid)
table.remove(players,playerchosen)
end
end
Does anyone know why this is happening and/or how to fix it?