How to "Shift" to sprint in Roblox Studio!

Поделиться
HTML-код
  • Опубликовано: 22 авг 2024

Комментарии • 1

  • @exoxrs
    @exoxrs  2 месяца назад +1

    -scripts-
    local Player = game.Players.LocalPlayer
    local Humanoid = Player.Character.Humanoid
    local ShiftToRun = false
    local OriginalWalkSpeed = 16 -- This is is what the players walkspeed will be on default
    local RunningWalkSpeed = 32 -- Change this to whatever you want the players walkspeed to be when they click shift.
    local function onKeyPress(input)
    if input.KeyCode == Enum.KeyCode.LeftShift then
    ShiftToRun = true
    Humanoid.WalkSpeed = RunningWalkSpeed
    end
    end
    local function onKeyRelease(input)
    if input.KeyCode == Enum.KeyCode.LeftShift then
    ShiftToRun = false
    Humanoid.WalkSpeed = OriginalWalkSpeed
    end
    end
    game:GetService("UserInputService").InputBegan:Connect(onKeyPress)
    game:GetService("UserInputService").InputEnded:Connect(onKeyRelease)