local lastTime = tick()
local Player = game.Players.LocalPlayer
local Character = Player.Character

Input.InputBegan:connect(function(KeyInput)
    if KeyInput.KeyCode == Enum.KeyCode.W then
        local now = tick()
        local difference = (now - lastTime)
        if difference <= 1 then
            Character.Humanoid.WalkSpeed = 30
        else
                Character.Humanoid.WalkSpeed = 16
        end
    end
end)

2 comments

0

How do I solve it?

0

maybe reset the lastTime value to tick() before the end of "if KeyInput.KeyCode == Enum.KeyCode.W then" statement