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
4 years ago

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

local t = script.Parent

for timer = 120, 0, -1 do

    t.Text = timer
end

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 — 4y
0
thanks DesertusX 435 — 4y

2 answers

Log in to vote
0
Answered by 4 years ago

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

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

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

local t = script.Parent

for timer = 120, 0, -1 do

    t.Text = tostring(timer)
end
0
Thanks. :D DesertusX 435 — 4y
0
Strange, it still doesn't work. DesertusX 435 — 4y
0
are you getting an error? PureLiteStudio 80 — 4y
0
you have to put wait(1) kujekmarek 24 — 4y

Answer this question