Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

How can I fix this?

Asked by
wjs3456 90
10 years ago

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
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

Any help? Thanks!

1 answer

Log in to vote
-1
Answered by 10 years ago

Try making time_left=(900) at line two time_left=900

Ad

Answer this question