local seconds = 180
local minutes = math.floor(seconds/60)
local remainder = seconds % 60
local clock = script.Parent.Parent.TextLabel
local debounce = false
script.Parent.MouseButton1Click:Connect(function()
if not debounce then
debounce = false
for i = 1, remainder do
wait(1)
if minutes > 9 then
if remainder - i < 10 then
clock.Text = minutes..":0"..remainder - i
else
clock.Text = minutes..":"..remainder - i
end
else
if remainder - i < 10 then
clock.Text = "0"..minutes..":0"..remainder - i
else
clock.Text = "0"..minutes..":"..remainder - i
end
end
end
for i = 1, minutes do
for i = 1, 60 do
wait(1)
if minutes > 9 then
if 60 - i < 10 then
clock.Text = minutes..":".."0"..(60-i)
else
clock.Text = minutes..":"..(60-i)
end
else
if 60 - i < 10 then
clock.Text = "0"..minutes..":0"..(60-i)
else
clock.Text = "0"..minutes..":"..(60-i)
end
end
end
minutes = minutes - 1
end
wait(180)
debounce = false
end
end)
I did alot of GUI scripts with debounce but this script is the longest. I just cant find out why the debounce doesnt work. Please help thank you.
The output says that line 4 has an error. But without the debounce this script works normally like a timer.
