I made a script for my game, but I got an error. Also, every time when the round is over, I don't get spawned in the lobby. This is my script:
--teleport plays back to lobby local lobbyspawns = {} for _, v in pairs(game.Workspace:WaitForChild("Lobby"):GetChildren()) do if v and v.Name == "SpawnLocation" then table.insert(lobbyspawns, v) end end for _, player in pairs(activecontestants) do if player then awardpoints(player, 1) if player.Character then local humanoid = player.Character:FindFirstChild("Humanoid") if humanoid then humanoid:UnequipTools() end end local randomspawn = lobbyspawns[math.random(1, #lobbyspawns)] player.Character:MoveTo(randomspawn.Position) local backpack = player:FindFirstChild("Backpack") if backpack then backpack:ClearAllChildren() end end end killer = nil sheriff = nil
This is the error (AGAIN)
10:48:41.721 - ServerScriptService.MainScript:458: bad argument #2 to 'random' (interval is empty) 10:48:41.723 - Script 'ServerScriptService.MainScript', Line 458 10:48:41.725 - Stack End