I was hoping that this script would make is so the time would start counting down again every time the round restarted(countdown function) and then if there were no survivors it would do the infected_finish function and if time ran out it would do the survivor_finish.
function countdown()
time_left=(900)
end
while true do
time_left=time_left-1
wait(1)
end
countdown()
function infected_finish(text,time)
if game.Teams.Survivors:GetPlayers()== nil then
m=Instance.new("Message",Workspace)
m.Text = text
wait(time)
m:Destroy()
for i,v in pairs(game.Players:GetPlayers()) do
v.Character.Humanoid.Health = 0
time_left=900
end
end
end
function survivor_finish(text,time)
if game.Teams.Survivors:GetPlayers()~= nil and time_left==0 then
m=Instance.new("Message",Workspace)
m.Text = text
wait(time)
m:Destroy()
end
for i,v in pairs(game.Players:GetPlayers()) do
v.Character.Humanoid.Health = 0
time_left=900
end
infected_finish("The final survivor has been killed. Infected win!",3)
survivor_finish("Time has run out,survivors win!",3)
end
Thanks

1 comment
Anything after a while function isn't ran. Place the While loop at the bottom.