So this is my script:
local seconds = 180
for i = 1,seconds do
wait(1)
seconds = seconds - 1
script.Parent.Music.Purchase.Text = seconds…" seconds until you can add another song"
end
After the timer hits zero, how would I make it say “Purchase” again?
Just place it after the end
of the for loop. For loops suspend the current thread to do it’s thing, and then continues once they’re done.
2 Likes
The easy way to do it is to just put code after the end
for the for loop, setting the text back to purchase.
local seconds = 180
for i = 1, seconds do
script.Parent.Music.Purchase.Text = seconds .. " seconds until you can add another song"
wait(1)
seconds = seconds - 1
end
script.Parent.Music.Purchase.Text = "Purchase"
The code above is yours, I would use the following code to make it actually show the time not the current time from 1 → 180
local seconds = 180
for i = seconds, 0, -1 do
script.Parent.Music.Purchase.Text = seconds .. " seconds until you can add another song"
wait(1)
end
script.Parent.Music.Purchase.Text = "Purchase"
2 Likes
It worked, thanks for the help guys!
1 Like