Idea is, a cooldown so they don't spam the Z Key, they have to wait 6 seconds. But I can still spam the key, even though i put the debounce there, am I doing something wrong? I don't get any warnings or errors.
UIS.InputBegan:Connect(function(key, isTalking)
if isTalking then return end
--------------------------FIRST POWER----------------------------------------------
local Debounce = false
if key.KeyCode == Enum.KeyCode.Z then
if Debounce == false then
Debounce = true
print("Clicked Z!")
game.ReplicatedStorage.EEnergy8Spells.firstSpell.firstMagic:FireServer(Mouse.Hit)
wait(6)
Debounce = false
end
end
end)

1 comment
I tried both of them, and none of them unfortunately worked, thanks for trying!