I removed the line if gameProcessed then return end
in both the began and ended.
It did not fix the problem.
Why just the 2 key for me and the 1 and 2 keys for @ballXXI
I removed the line if gameProcessed then return end
in both the began and ended.
It did not fix the problem.
Why just the 2 key for me and the 1 and 2 keys for @ballXXI
Here, I wrote a better script for you. This one really is not that good.
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local UserInputService = game:GetService("UserInputService")
local WALK_SPEED = 6
local RUN_SPEED = 20
local SPEED_INCREMENT = 2
local WAIT_TIME = 0.1
local function easeIntoRun()
local currentSpeed = WALK_SPEED
while currentSpeed < RUN_SPEED do
currentSpeed = currentSpeed + SPEED_INCREMENT
Humanoid.WalkSpeed = currentSpeed
wait(WAIT_TIME)
end
Humanoid.WalkSpeed = RUN_SPEED
end
local function onInputBegan(input, gameProcessed)
if input.KeyCode == Enum.KeyCode.LeftShift then
easeIntoRun()
end
end
local function onInputEnded(input)
if input.KeyCode == Enum.KeyCode.LeftShift then
Humanoid.WalkSpeed = WALK_SPEED
end
end
UserInputService.InputBegan:Connect(onInputBegan)
UserInputService.InputEnded:Connect(onInputEnded)
kind of unrelated, but why don’t you just use tween service to increase the speed?
edit: that’s what the other guy suggested, but it’s a much better method.