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

How to fix debounce being bypassed?

Hello, currently I am trying to fix an issue with a local script inside my tool.

The tool's click cool down is functional except for when a player will equip and unequip the tool very fast.

My code can be found here:

local remote = game.ReplicatedStorage.Events.Greens.GreenWrite
local debounce = false


game.Players.LocalPlayer:GetMouse().Button1Down:Connect(function()
				
if not debounce then
debounce = true

		
remote:FireServer()
wait(1)
debounce = false


				end
end)

1 answer

Nevermind, I have fixed this by setting the debounce on the server instead of locally.

1 comment

0

Never trust the client. Checking everything on the server would be the right thing.

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