I honestly dont know whats wrong
local function teleportToLobby()
roundRunning = false
for i, character in pairs(playersInGame:GetChildren()) do
changeStatus("Teleporting players to lobby...")
local selectedSpawn = lobbySpawns[math.random(1, #lobbySpawns)]
character.HumanoidRootPart.CFrame = selectedSpawn.CFrame
character.Parent = playersInLobby
end
gameFolder:WaitForChild("Map"):ClearAllChildren()
end
local function teleportToGame()
if not map:FindFirstChild("Map") and not gameFolder:WaitForChild("Map"):FindFirstChild("Sharknado") then
local map = gameFolder:WaitForChild("Map")
local newMap = ClonedMap:Clone()
newMap.Parent = map
else
return
end
wait(1.75)
local gameSharknado = game.ReplicatedStorage.GameObjects.Sharknado:Clone()
gameSharknado.Parent = map
roundRunning = true
for i, character in pairs(playersInLobby:GetChildren()) do
changeStatus("Teleporting players to game...")
local randomSpawns = gameFolder.Map.Map.Spawns:GetChildren()
local selectedSpawn = randomSpawns[math.random(1, #randomSpawns)]
character.HumanoidRootPart.CFrame = selectedSpawn.CFrame
character.Parent = playersInGame
end
end
while true do
wait(intermissionTime)
teleportToGame()
while true do
wait()
local amtOfPlayers = playersInGame:GetChildren()
if #amtOfPlayers <= 1 then
roundRunning = false
for i, char in pairs(playersInGame:GetChildren()) do
if char then
changeStatus(char.Name.." won!")
end
end
teleportToLobby()
break
else
return
end
end
end