Autoclicking tools issue (Debounce)

I have an issue where you can auto-click abilities (tools) to have them happen multiple times despite having a cooldown.

Here’s the code logic for how cooldowns work:

If debounce == false then
debounce = true
–Do things
debounce = false

Even though this sets the debounce to true instantly, there’s still a delay where it can still do it (I assume that’s why).
It also seems to happen if you can somehow click NORMALLY really fast, as well.

Any good ways to get around this?

Or should I have an anti-cheat thing that tests for auto-clickers?

Are you using the default Roblox toolbar? I don’t see how this would allow for more than one consecutive click.

I dont know if this changes anything but maybe use this??

local debounce = false
debounce = true
--script stuff
debounce = false

Whoops, actually this might’ve been mostly a problem on my part. I think putting an extra wait(0.1) in a script to delay part of the ability causes the ability to be able to be auto-clicked for some reason?

Because removing it fixed it. Alright, sorry everybody.