Advertisement
EconomicSerg

ROBLOX Shift to Sprint

Oct 14th, 2020 (edited)
354
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.19 KB | None | 0 0
  1. -- 100 views!!!!!
  2.  
  3. -- Script by EconomicSerg
  4. -- Works on ROBLOX only
  5. -- Put a LocalScript into StarterPlayer>StarterCharacterScripts or StarterPlayerScripts
  6.  
  7. local UIS = game:GetService("UserInputService")
  8. local Player = game.Players.LocalPlayer or game:GetService("Players").LocalPlayer
  9. local Character = Player.Character or Player.CharacterAdded:Wait()
  10.  
  11. local isRunning = false
  12.  
  13. UIS.InputBegan:Connect(function(Key)
  14.     if Key.KeyCode == Enum.KeyCode.LeftShift or Key.KeyCode == Enum.KeyCode.RightShift then -- Determining whether the player hits "LeftShift" or "RightShift" on their keyboard
  15.         isRunning = true -- Variable saying that the player is running
  16.         if Character.Humanoid then
  17.             Character.Humanoid.WalkSpeed = 32 -- The speed the player gets when running
  18.         end
  19.     end
  20. end)
  21.  
  22. UIS.InputEnded:Connect(function(Key)
  23.     if Key.KeyCode == Enum.KeyCode.LeftShift or Key.KeyCode == Enum.KeyCode.RightShift then -- Determining whether the player lets go of "LeftShift" or "RightShift" on their keyboard
  24.         isRunning = false -- Variable saying that the player is not running
  25.         if Character.Humanoid then
  26.             Character.Humanoid.WalkSpeed = 16 -- The speed the player gets when walking
  27.         end
  28.     end
  29. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement