What is the issue?
I have a script that allows the player to dash and do an explosive ability, I’m trying to make the explosive ability have a cooldown of 5, but if the player does the explosive ability, before the debounce is set to false, the player can’t dash during the cooldown.
Should I make a separate debounce for the explosive ability?
if input.KeyCode == Enum.KeyCode.Q then
local state = character:GetAttribute("State")
if state ~= "Idle" then print("Cannot Evade") return end
if not debounce then
debounce = true
-- debounce
print("Evade")
animator:LoadAnimation(game.StarterPack.Animations.Dash):Play()
game.ReplicatedStorage.Events.EvadeEvent:FireServer(state)
local linearvelocity = Instance.new("LinearVelocity")
local linearattachment = Instance.new("Attachment")
linearvelocity.MaxForce = 25000
linearvelocity.Attachment0 = linearattachment
linearvelocity.Parent = linearattachment
linearattachment.Parent = character.HumanoidRootPart
game.Debris:AddItem(linearattachment,.4)
local heart = game:GetService("RunService").Heartbeat:Connect(function()
linearvelocity.VectorVelocity = character.HumanoidRootPart.CFrame.LookVector * 50
end)
task.wait(.5)
heart:Disconnect()
debounce = false
end
end
if input.KeyCode == Enum.KeyCode.T and not debounce then
debounce = true
humanoid.WalkSpeed = 5
animator:LoadAnimation(game.StarterPack.Animations.Explosion):Play()
combathandler.Fire.Explosion(player)
humanoid.WalkSpeed = 16
task.wait(5)
debounce = false
end
end)