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

Simple for loop not working in a TextLabel?

Asked by
DesertusX 435 Moderation Voter
5 years ago

I made a timer script using a for loop and it's not working? The following is the script.

1local t = script.Parent
2 
3for timer = 120, 0, -1 do
4 
5    t.Text = timer
6end

It's a very simple script. It's also my first time using a for loop. Any ideas on why it's not working? Thanks for helping.

0
you have to put wait(1) kujekmarek 24 — 5y
0
thanks DesertusX 435 — 5y

2 answers

Log in to vote
0
Answered by 5 years ago

Your script is fine; you just have to type in wait(1) inside of the for loop.

0
Thank you. DesertusX 435 — 5y
Ad
Log in to vote
0
Answered by 5 years ago

Your problem is you're using a int value not a string value

1local t = script.Parent
2 
3for timer = 120, 0, -1 do
4 
5    t.Text = tostring(timer)
6end
0
Thanks. :D DesertusX 435 — 5y
0
Strange, it still doesn't work. DesertusX 435 — 5y
0
are you getting an error? PureLiteStudio 80 — 5y
0
you have to put wait(1) kujekmarek 24 — 5y

Answer this question