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

Is there a limit to debug time?

Asked by 10 years ago

basically my script is like this (Keep in mind some parts of this have been shortened or modified for ease of understanding):

debug = false firing = false

IfTheGUIHasMouseDown(function() if debug = true then return end debug = true firing = true while firing = true do if Ammo ~= 0 then fire() wait(0.1) firing = false end end end)

IfTheMouseIsLiftedFromGUI(function() firing = false if debug = true then wait(0.1) debug = false end end)

======= My issue here is that I need to prevent the gun from having double fire. The debug works if you double click the GUI slowly, but if you're fast enough the debug simply doesn't work. From my understanding when MouseButton1 is lifted debug shouldn't become false for another 0.1 seconds, but that doesn't happen. Help?

0
It would help if you posted the actual script so I could explain why it's wrong. 1waffle1 2908 — 10y

1 answer

Log in to vote
0
Answered by
1waffle1 2908 Trusted Badge of Merit Moderation Voter Community Moderator
10 years ago

There is no limit to debounce time. The only reason it wouldn't be working would be if there is a delay before the debounce is actually triggered.

debounce=false
mouse.Button1Down:connect(function()
    if not debounce then
        debounce = true -- instant
        print("clicked")
        wait(1)
        debounce=false
    end
end)
Ad

Answer this question