Iv'e changed up a double tap script so it plays an animation and changes the walkspeed. I found out that if I'm still hold W after double tapping then the walkspeed stays at 20 instead of reverting back to 16, I don't know how to fix this.
click = false locplay = game.Players.LocalPlayer human = locplay.Character.Humanoid char = locplay.Character local Anim = Instance.new("Animation") Anim.AnimationId = "rbxassetid://1453429139" game:GetService("UserInputService").InputBegan:connect(function(input1) if input1.KeyCode == Enum.KeyCode.W then if click then print("W was double tapped.") char.Humanoid.WalkSpeed = 20 local playAnim = char.Humanoid:LoadAnimation(Anim) playAnim:Play() return end click = true wait(0.4) click = false end end) game:GetService("UserInputService").InputEnded:connect(function(input1) if input1.KeyCode == Enum.KeyCode.W then char.Humanoid.WalkSpeed = 16 end end)
You need to set click back to false. Otherwise, it will stay true forever, confusing your script. I redid the code so that there are two variables, making it easier for the script. New Code:
isPressing = false click = false locplay = game.Players.LocalPlayer human = locplay.Character.Humanoid char = locplay.Character local Anim = Instance.new("Animation") Anim.AnimationId = "rbxassetid://1453429139" game:GetService("UserInputService").InputBegan:connect(function(input1) if click then isPressing = true end if input1.KeyCode == Enum.KeyCode.W then if isPressing then print("W was double tapped.") char.Humanoid.WalkSpeed = 20 local playAnim = char.Humanoid:LoadAnimation(Anim) playAnim:Play() return end click = true wait(0.4) click = false end end) game:GetService("UserInputService").InputEnded:connect(function(input1) if input1.KeyCode == Enum.KeyCode.W then if isPressing then isPressing = false char.Humanoid.WalkSpeed = 16 end end end)