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

Countdown script, numbers not showing?

Asked by 7 years ago

Hello! I made this countdown script with the help of BOF, but it dosnt work anyways. So is there a way to get it to work? It doesnt show the numbers when I put while true

1while true do
2wait(1)
3for i = 30,0,-1 do
4wait(1)
5script.Parent.Text = math.floor(i)
6wait(60)
7end

2 answers

Log in to vote
0
Answered by
RootEntry 111
7 years ago

Instead of using math.floor, I recommend doing this:

1while true do
2wait(1)
3    for i = 30,0,-1 do
4    script.Parent.Text = "Intermission: "..i
5    wait(1)
6    end
7end
0
I used that before, it didnt work properly. But I already got the script to work :V ItzFireable 17 — 7y
0
Then accept the answer q.q Goulstem 8144 — 7y
Ad
Log in to vote
2
Answered by 7 years ago

No.1 Use indents so that the code is cleaner

No.2 You don't need the wait that's straight after the while true do.

No.3 Make sure you think about what your code is doing.

No.3 Make sure you end the block with the while true do.

You didn't need to use math.floor because the script is controlling the for loop's increments anyways.(All it'd do is make it increment another time, when it isn't needed because the third number in the for loops declaration controls that)

Other than that, just make sure you don't add any unnecessary waits because they're not useful and just make the thread slow down even more.

Here's my rewritten version!

1while true do
2    for i = 30,0,-1 do
3        wait(60)
4        script.Parent.Text = math.floor(i)
5    end
6end

Good luck scripting!

0
I already got it to work perfectly while this, but thank you! ItzFireable 17 — 7y

Answer this question