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

How to fix debounce being bypassed?

Asked by 5 years ago

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:

01local remote = game.ReplicatedStorage.Events.Greens.GreenWrite
02local debounce = false
03 
04 
05game.Players.LocalPlayer:GetMouse().Button1Down:Connect(function()
06 
07if not debounce then
08debounce = true
09 
10 
11remote:FireServer()
12wait(1)
13debounce = false
14 
15 
16                end
17end)

1 answer

Log in to vote
0
Answered by 5 years ago

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

0
Never trust the client. Checking everything on the server would be the right thing. Syclya 224 — 5y
Ad

Answer this question