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

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

Asked by 4 years ago
Edited 4 years ago

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

0
Omg I just realized The script and the output has the same amount of lines! I didn't that on accident! marioman1932 48 — 4y

1 answer

Log in to vote
2
Answered by 4 years ago

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

0
Thanks! marioman1932 48 — 4y
0
Glad I helped :D GGRBXLuaGG 417 — 4y
Ad

Answer this question