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)

1 comment
sorry i didn't understand what you mean, what is wrong?