I'm trying to add a cooldown to this dash script, but I don't know where to put wait() or where to make the cooldown.
local plr = game.Players.LocalPlayer
local Char = plr.Character or plr.CharacterAdded:Wait()
local UserInputService = game:GetService("UserInputService")
local Time = 1
local anim = Instance.new("Animation")
anim.Parent = script.Parent
anim.AnimationId = "rbxassetid://4879489579"
UserInputService.InputBegan:Connect(function(Input, GameStuff)
if GameStuff then return end
if Input.KeyCode == Enum.KeyCode.Q then
local track = Char:WaitForChild("Humanoid"):LoadAnimation(anim)
Char.HumanoidRootPart.Velocity = Char.HumanoidRootPart.CFrame.lookVector*150
track:Play()
wait(Time) -- Do I put this here?
end
-- or here?
end)

5 comments
add a variable that is set to true on start, and disable on end, then put Time in wait and I don't think it matters where you put the wait(Time)
what kind of variable?
you didn't write this script did you....
I wrote the script, I rewrote what you sent me and then tested it out. The cooldown was too long so I reduced the Time to 0.5 secs, after I tested it it was perfect! Thank You!
Please do some research it seems ur a beginner.