Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Simple for loop not working in a TextLabel?

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.

2 comments

0

you have to put wait(1)

0

thanks

2 answers

✓ Accepted answer

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

1 comment

0

Thank you.

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

4 comments

0

Thanks. :D

0

Strange, it still doesn't work.

0

are you getting an error?

0

you have to put wait(1)

This discussion is preserved as it was. New answers, comments, and votes are closed.