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 4 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:

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

Log in to vote
0
Answered by 4 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 — 4y
Ad

Answer this question