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

? My timer's text isn't changing even though the if statement works! (ANSWERED)

I have a a clock gui that counts down, it's unfinished, but this is what I have so far

local seconds = 160
local minutes = math.floor(seconds/60)--Round down
local percentage = seconds%60
local clock = script.Parent.Text

for i = 1, percentage do
	wait(1)
	sec = percentage-i
	print(percentage, i, seconds, percentage-i)
	if percentage-i < 10 then
		print(1)
		clock = "0"..minutes..":0"..sec
	else		
		print(2)
		clock = "0"..minutes..":"..sec
	end
end

The output after it's done is:

40 1 160 39
2
40 2 160 38
2
40 3 160 37
2
.
.
.
40 37 160 3
1
40 38 160 2
1
40 39 160 1
1
40 40 160 0
1

but the timer is still the same: 0:00 I don't know why it isn't changing, when the if statement is working, everything else inside the if statement seem to be firing, but the code to change the time. Please help me

1 comment

0

Omg I just realized The script and the output has the same amount of lines! I didn't that on accident!

1 answer

✓ Accepted answer

When you typed clock = script.Parent.Text you have stored what was in script.Parent.Text

You have to call it again, just do another script.Parent.Text = YourTextHere

2 comments

0

Thanks!

0

Glad I helped :D

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