|
| 20 Jan 2015 09:42 PM |
So my script goes like this : game.StarterGui.ScreenGui.TextLabel.Text = "Minigame / Obby / Survival will start in : 30 secs" wait(1)
With 30 Seconds counting down. But It does work and that means I wasted 5 minutes of copy paste, how do I make it count down, and yet not make it 60 lines? |
|
|
| Report Abuse |
|
|
|
| 20 Jan 2015 10:05 PM |
Put this script in the text label
label = script.Parent
count = 30 --//Countdown print("hey") while wait(1) do label.Text = "Minigame / Obby / Survival will start in : " .. count .. " seconds" count = count - 1 if count == 0 then break --move onto next task end end
print("Countdown over") |
|
|
| Report Abuse |
|
|
|
| 20 Jan 2015 10:08 PM |
| I was also thinking of making it wait 30 secs, then repeat because its like the "Survive the disasters" |
|
|
| Report Abuse |
|
|
|
| 20 Jan 2015 10:13 PM |
You'll probably need to make some sort of BoolValue in the Workspace so the script knows when to countdown, because other players will not be synced with this counter.
If you want it to repeat a counter then you could try the following, but it may not work as hoped since I'm currently not in Studio anymore.
label = script.Parent count = 30 --//Countdown
function countdown() while wait(1) do label.Text = "Minigame / Obby / Survival will start in : " .. count .. " seconds" count = count - 1 if count == 0 then break --move onto next task end end end
while wait(30) do countdown() end
|
|
|
| Report Abuse |
|
|
|
| 20 Jan 2015 10:18 PM |
When I did BOTH of em ( 1 at a time ) They all said "21:16:42.942 - Text is not a valid member of PlayerGui" |
|
|
| Report Abuse |
|
|
|
| 20 Jan 2015 10:19 PM |
| Have you possibly put the script inside the PlayerGui instead of the TextLabel? |
|
|
| Report Abuse |
|
|
| |
|
|
| 20 Jan 2015 10:23 PM |
| Well the script is designed to be inside the TextLabel to work, were you looking for it to be outside the TextLabel? |
|
|
| Report Abuse |
|
|
| |
|
|
| 20 Jan 2015 10:25 PM |
| Yay it worked now for the repeat |
|
|
| Report Abuse |
|
|
|
| 20 Jan 2015 10:27 PM |
Fixed an error, forgot to make the timer reset to it's original value.
label = script.Parent count = 30 --//Countdown
function countdown() local re_record = count while wait(1) do label.Text = "Minigame / Obby / Survival will start in : " .. count .. " seconds" count = count - 1 if count == 0 then count = re_record break --move onto next task end end end
while wait(30) do countdown() end |
|
|
| Report Abuse |
|
|
|
| 20 Jan 2015 10:51 PM |
| Now it's just not working of of the sudden, I have it in TextLabel |
|
|
| Report Abuse |
|
|
|
| 20 Jan 2015 11:10 PM |
| The repeat doesn't start the count down, yet no errors too |
|
|
| Report Abuse |
|
|