Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Is there a limit to debug time?

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?

1 comment

0

It would help if you posted the actual script so I could explain why it's wrong.

1 answer

✓ Accepted answer

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.