I need a Debounce in this script to prevent it from being spammed.
I assume the Debounce needs to be placed within the part unlocked by the return, but I haven't been able to do it.
Putting it outside like normal makes the script stop functioning. Same as inside.
You can spam it easily, an infinitely.
With any debounce I have added, it's caused the script to stop working entirely. EDIT: IT IS SUPPOSED TO ACTIVATE A LEFTWARD DASHING MOTION ON DOUBLE TAP
work = false
tap = false
locplay = game.Players.LocalPlayer
human = locplay.Character.Humanoid
game:GetService("UserInputService").InputBegan:connect(function(input1)
if input1.KeyCode == Enum.KeyCode.A then
if tap then
print("blah")
local anim = Instance.new("Animation",human)
anim.AnimationId = "https://www.roblox.com/DashLEFT-item?id=454485046"
local animtrack = human:LoadAnimation(anim)
animtrack:Play()
for i = 0,-2.5,-.5 do
wait(.25)
local Left = human.Parent.Torso.CFrame * CFrame.new(i,0,0)
human.Parent.Torso.CFrame = Left
end
animtrack:Stop()
return
end
tap = true
wait(.4)
tap = false
else
end
end)

1 comment
Thanks. You technically answered my question. Unfortunately, I neglected to put what my script was supposed to do. So you answer won't work as the script is supposed to be used on double tap.(Thus the return)