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

Why is my debounce not working properly?

Asked by 4 years ago
01local seconds = 180
02local minutes = math.floor(seconds/60)
03local remainder = seconds % 60
04local clock = script.Parent.Parent.TextLabel
05local debounce = false
06 
07script.Parent.MouseButton1Click:Connect(function()
08if not debounce then
09debounce = false
10for i = 1, remainder do
11wait(1)
12if minutes > 9 then
13if remainder - i < 10 then
14clock.Text = minutes..":0"..remainder - i
15else
View all 48 lines...

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.

2 answers

Log in to vote
1
Answered by 4 years ago

See it's a simple mistake, don't worry I also make it all the time.

The error is found in line 9

you put:

1debounce = false

after that it's self explanatory

Ad
Log in to vote
0
Answered by 4 years ago

You put if not debounce then debounce = false It should be true.

Answer this question