Basically, I have a loop which starts with an intermission of 15 seconds, then starts the round, starts the first wave, then repeats wait(1) until no people are left on the human team.
while true do
intermission(INTERMISSION_TIME) -- teleports players to lobby and waits INTERMISSION_TIME
print("Round starting!")
start() -- teleports players to map
wave(1) --starts first wave
repeat
task.wait(1)
until #game.Teams.Humans:GetPlayers() == 0 and #game.Teams.Zombies:GetPlayers() > 0 --wait until every player is on the zombie team
end
However, without breaking the loop, or running it again, I want to wait a certain time (for example 1 minute) until starting the second wave. (wave function)
you want to wait for some time before starting the next wave maybe make it wait() after repeat function. Like this
while true do
intermission(INTERMISSION_TIME) -- teleports players to lobby and waits INTERMISSION_TIME
print("Round starting!")
start() -- teleports players to map
wave(1) --starts first wave
repeat
task.wait(1)
until #game.Teams.Humans:GetPlayers() == 0 and #game.Teams.Zombies:GetPlayers() > 0 --wait until every player is on the zombie team
wait(60)
end
local currentWave = 1
while true do
intermission(INTERMISSION_TIME) -- teleports players to lobby and waits INTERMISSION_TIME
print("Wave "..currentWave.." starting!")
start() -- teleports players to map
wave(currentWave) --starts current wave
repeat task.wait(1)
until #game.Teams.Humans:GetPlayers() == 0 and #game.Teams.Zombies:GetPlayers() > 0 or #game.Teams.Zombies:GetPlayers() == 0
if #game.Teams.Zombies:GetPlayers() == 0 then
currentWave = currentWave +1
else
currentWave = 1
end
end