Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Holding left shift to sprint and memorizing original stances?

Asked by 6 years ago
Edited 6 years ago
DirectoryKeys["LeftShift"] = function()
local Dude = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")

    if Sprinting == false then
    local PriorWalkSpeed = Dude.WalkSpeed
    local PriorWR = WR.Value
    local PriorStance = Stance.Value
    Sprinting = true
    Dude.WalkSpeed = 22
    Stance.Value = 3

        if PrimAnim == true then
        WR.Value = 2
        else
        WR.Value = 1
        end

    WeaponReadiness()
    StancePosition()
    script.Parent.Parent.PlayerGui.WeaponUI.Frame.SPSDisplay.Text = "WalkSpeed: "..Dude.WalkSpeed
    else
    Sprinting = false
    WR.Value = 3
    Stance.Value = 3 -- These three numbers here are where the "memorized stances" go.
    Dude.WalkSpeed = 13.5
    WeaponReadiness()
    StancePosition()
    script.Parent.Parent.PlayerGui.WeaponUI.Frame.SPSDisplay.Text = "WalkSpeed: "..Dude.WalkSpeed
    end

end

If i wanted to have it set to only sprint if I'm holding Left Shift down... how would I go about it? On top of that, I need it to remember the original speed and stances. So that it reverts back to them afterwards.

[EDIT]: Worth noting that it's also supposed to cease sprinting when I let go of the Left Shift.

Answer this question