I've tried multiple scenarios. What I am trying to do is allow a basic function to fire when You double tap "A", but I can't seem to do it. I assume the problem is that input2 is already being set as "A" when I first press it because pressing it for the second time in the game means that every time you press it hence it will fire the function.
bool = true locplay = game.Players.LocalPlayer human = locplay.Character.Humanoid game:GetService("UserInputService").InputBegan:connect(function(input1) if input1.KeyCode == Enum.KeyCode.A then local bool = false wait(.02) if bool == false then game:GetService("UserInputService").InputBegan:connect(function(input2) if input2.KeyCode == Enum.KeyCode.A then local bool = true if bool == true then human.WalkSpeed = 50 wait(.25) human.WalkSpeed = 16 end end end) end end end) bool = false
Try this code out:
click = false locplay = game.Players.LocalPlayer human = locplay.Character.Humanoid game:GetService("UserInputService").InputBegan:connect(function(input1) if input1.KeyCode == Enum.KeyCode.A then if click then print("A was double tapped") return end click = true wait(0.4) click = false end end)