I'm making a game where you have a certain amount of time to destroy a wall. This script is basically acting as a countdown timer. I'm using another script inside a gui to get the time information so the player can see. Its supposed to loop and start back at 10:00 after is restarts. (I have another script that makes the wall regenerate when the value of "Clock" is "Restarting...") This all works perfectly in test mode but when I actually play the game it just keeps restarting. Someone help plz lol
TimeInSeconds = 600
TimeInMinutes = math.floor(TimeInSeconds/60)
remainder = TimeInSeconds % 60
clockText = script.Parent.Clock
while wait() do
for i = 1, remainder do
wait(1)
if TimeInMinutes > 9 then
if remainder - i < 10 then
clockText.Value = TimeInMinutes..":0"..remainder-i..""
else
clockText.Value = TimeInMinutes..":"..remainder-i..""
end
else
if remainder - i < 10 then
clockText.Value = "0"..TimeInMinutes..":0"..remainder-i..""
else
clockText.Value = "0"..TimeInMinutes..":"..remainder-i..""
end
end
end
for i = 1, TimeInMinutes do
TimeInMinutes = TimeInMinutes - 1
for i = 1, 60 do
wait(1)
if TimeInMinutes > 9 then
if 60 - i < 10 then
clockText.Value = TimeInMinutes..":".."0"..(60-i)..""
else
clockText.Value = TimeInMinutes..":"..(60-i)..""
end
else
if 60 - i < 10 then
clockText.Value = "0"..TimeInMinutes..":0"..(60-i)..""
else
clockText.Value = "0"..TimeInMinutes..":"..(60-i)..""
end
end
end
end
clockText.Value = "Restarting..."
wait(2)
end

1 comment
Thank you so much!