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

UserInputService debounce able to be bypassed by spam clicking..?

Asked by 4 years ago
local debounce = false
function attack_A1(inputObject, gameProcessedEvent)
    if inputObject.UserInputType == Enum.UserInputType.MouseButton1 
    and debounce == false then
        debounce = true
        if not gameProcessedEvent 
        and equipWandFrame.Visible == true then
            local mouse = player:GetMouse()
            local mousehit = mouse.Hit.p
            local cast = game.ReplicatedStorage.Gui.cast
            local spell = playerData.DATA_SpellEquipped
            cast:FireServer(spell.Value, mousehit)
        end
    end
    wait(2)
    debounce = false
end
game:GetService("UserInputService").InputBegan:connect(attack_A1)

This is the portion of the script I am having trouble with, basically, what it does is, when a player clicks, it sends off certain data to the ServerScript, and then the ServerScript takes the wheel from there, anyway- I join a test server and I begin to click rapidly, to test and see if it works, correctly, and it doesn't, somehow the rapid firing of the mouse click breaks the debounce, and then there is no cooldown for the projectile.. Why is the debounce breaking?

0
"debounce = true" KDarren12 705 — 4y
0
Your point being? ImperiumDomini2 39 — 4y

Answer this question