|
| 30 Aug 2011 10:16 AM |
Somebody help me edit my script so that it loops forever. Here is the script.
h = Instance.new("Hint")
function Countdown(min,sec,txt,pretxt) h.Parent = game.Workspace for i = 1, sec + (min * 60) + 1 do if sec < 10 and min == 0 then h.Text = pretxt.." 0:0"..sec.." "..txt elseif sec < 10 then h.Text = pretxt.." "..min..":0"..sec.." "..txt elseif sec + (min * 60) < 60 then h.Text = pretxt.." 0:"..sec.." "..txt elseif sec + (min * 60) > 59 then h.Text = pretxt.." "..min..":"..sec.." "..txt end wait(1) if sec > 0 then sec = sec - 1 elseif sec == 0 and min ~= 0 then sec = 59 min = min - 1 elseif sec == 0 and min == 0 then print("Ended") end end h.Parent = nil end
mins = 10 --Set this to the amount of minutes secs = 00 --Set this to the amount of seconds text = "to destroy the giant zombie before it regenerates." --Set this to the text you want it to say after the numbers pretext = "Players have" --Set this to the text you want it to say the numbers Countdown(mins,secs,text,pretext) |
|
|
| Report Abuse |
|
|
|
| 30 Aug 2011 10:17 AM |
while true do h = Instance.new("Hint")
function Countdown(min,sec,txt,pretxt) h.Parent = game.Workspace for i = 1, sec + (min * 60) + 1 do if sec < 10 and min == 0 then h.Text = pretxt.." 0:0"..sec.." "..txt elseif sec < 10 then h.Text = pretxt.." "..min..":0"..sec.." "..txt elseif sec + (min * 60) < 60 then h.Text = pretxt.." 0:"..sec.." "..txt elseif sec + (min * 60) > 59 then h.Text = pretxt.." "..min..":"..sec.." "..txt end wait(1) if sec > 0 then sec = sec - 1 elseif sec == 0 and min ~= 0 then sec = 59 min = min - 1 elseif sec == 0 and min == 0 then print("Ended") end end h.Parent = nil end
mins = 10 --Set this to the amount of minutes secs = 00 --Set this to the amount of seconds text = "to destroy the giant zombie before it regenerates." --Set this to the text you want it to say after the numbers pretext = "Players have" --Set this to the text you want it to say the numbers Countdown(mins,secs,text,pretext)
ta da! |
|
|
| Report Abuse |
|
|
|
| 30 Aug 2011 10:20 AM |
Lol @ above.
You're just defining the function repeatedly. That wouldn't make it loop .-.
You'd have to loop the part where it actually CALLS the function at the bottom.
Regards, ~Scarfacial |
|
|
| Report Abuse |
|
|
|
| 30 Aug 2011 10:41 AM |
| can you show me an example of that |
|
|
| Report Abuse |
|
|
|
| 30 Aug 2011 11:33 AM |
h = Instance.new("Hint")
function Countdown(min,sec,txt,pretxt) h.Parent = game.Workspace for i = 1, sec + (min * 60) + 1 do if sec < 10 and min == 0 then h.Text = pretxt.." 0:0"..sec.." "..txt elseif sec < 10 then h.Text = pretxt.." "..min..":0"..sec.." "..txt elseif sec + (min * 60) < 60 then h.Text = pretxt.." 0:"..sec.." "..txt elseif sec + (min * 60) > 59 then h.Text = pretxt.." "..min..":"..sec.." "..txt end wait(1) if sec > 0 then sec = sec - 1 elseif sec == 0 and min ~= 0 then sec = 59 min = min - 1 elseif sec == 0 and min == 0 then print("Ended") end end h.Parent = nil end
mins = 10 --Set this to the amount of minutes secs = 00 --Set this to the amount of seconds text = "to destroy the giant zombie before it regenerates." --Set this to the text you want it to say after the numbers pretext = "Players have" --Set this to the text you want it to say the numbers while wait() do Countdown(mins,secs,text,pretext) end |
|
|
| Report Abuse |
|
|