I have a sword ability but when you spam R it keeps playing completely disregarding the cooldown, can someone help me?
Local Script inside of tool
local UIS = game:GetService("UserInputService")
local controls = require(game:GetService("Players").LocalPlayer.PlayerScripts.PlayerModule):GetControls()
local Equipped = false
local Cooldown = false
script.Parent.Equipped:Connect(function()
Equipped = true
print(Equipped)
end)
script.Parent.Unequipped:Connect(function()
Equipped = false
print(Equipped)
end)
while true do
wait()
if Equipped == true and Cooldown == false then
UIS.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.R then
Cooldown = true
game.ReplicatedStorage.Parry:FireServer()
controls:Disable()
print("Player press R")
wait(3)
controls:Enable()
wait(5)
Cooldown = false
end
end)
end
end

3 comments
Omg i never thought of that, sometimes i just dont think when im scripting, ty!
Omg i never thought of that, sometimes i just dont think when im scripting, ty!
If this helped, mark it as an answer for other people!