Advertisement
dubleeyrblxx

Shift to Sprint -- Roblox

Jul 5th, 2020
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.89 KB | None | 0 0
  1. -- Local script
  2. -- Shift to Sprint
  3. -- Put in StarterGui
  4. -- (sorry for not fixing it before)
  5.  
  6. inputService = game:GetService("UserInputService")
  7. local plr = game.Players.LocalPlayer
  8. local char = plr.Character or plr.CharacterAdded:wait()
  9.  
  10. local normalSpeed = 16 -- The player's speed while not sprinting
  11. local sprintSpeed = 26 -- The player's speed while sprinting
  12. local sprinting = false
  13.  
  14. inputService.InputBegan:Connect(function (key)
  15.     if key.KeyCode == Enum.KeyCode.LeftShift or key.KeyCode == Enum.KeyCode.RightShift then
  16.         running = true
  17.         if char.Humanoid then  
  18.             char.Humanoid.WalkSpeed = sprintSpeed
  19.         end
  20.     end
  21. end)
  22.  
  23. inputService.InputEnded:Connect(function (key)
  24.     if key.KeyCode == Enum.KeyCode.LeftShift or key.KeyCode == Enum.KeyCode.RightShift then
  25.         running = false
  26.         if char.Humanoid then  
  27.             char.Humanoid.WalkSpeed = normalSpeed
  28.         end
  29.     end
  30. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement