Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How can I fix this?

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

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

This discussion is preserved as it was. New answers, comments, and votes are closed.