I am making a dash script and successfully did it but the players spams it. i want to fix this but i don't know how to do it.
The Code:
local player = game.Players.LocalPlayer
repeat wait() until player.Character.Humanoid````
local humanoid = player.Character.Humanoid
local mouse = player:GetMouse()
local anim = Instance.new("Animation")
anim.AnimationId = "http://www.roblox.com/asset/?id=1824890937"
mouse.KeyDown:connect(function(key)
if string.byte(key) == 50 then
local playAnim = humanoid:LoadAnimation(anim)
playAnim:Play()
script.Sound:Play()
player.Character.HumanoidRootPart.Velocity = player.Character.HumanoidRootPart.CFrame.lookVector * 125
wait(1.5)
end
wait(10)
end)

2 comments
Where do i put it tho? im a newbie at scripting sorry
on your if statement in line 50 you can make the condition 'string.byte(key) == 50 and tick() - lastClicked > cooldown' or something similar.