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)
Gave it a shot - I essentially used tap as the debounce variable, let me know if this does what you need
work = false tap = true 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 tap = false 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() wait(.4) tap = true end end end)