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

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

2 answers

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

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

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

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

Good luck scripting!

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

Answer this question