Advertisement
KashTheKingYT

Shift To Run

Jan 29th, 2022
1,326
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.69 KB | None | 0 0
  1. local char = script.Parent
  2. local hum = char:WaitForChild("Humanoid")
  3.  
  4. local uis = game:GetService("UserInputService")
  5.  
  6. local running = false
  7.  
  8. function setSpeed()
  9.     if running == true then
  10.         hum.WalkSpeed = 32
  11.     else
  12.         hum.WalkSpeed = 16
  13.     end
  14. end
  15.  
  16. uis.InputBegan:Connect(function(input, isTyping)
  17.     if not isTyping then
  18.         if input.KeyCode == Enum.KeyCode.LeftShift or input.KeyCode == Enum.KeyCode.RightShift then
  19.             running = true
  20.             setSpeed()
  21.         end
  22.     end
  23. end)
  24.  
  25. uis.InputEnded:Connect(function(input, isTyping)
  26.     if not isTyping then
  27.         if input.KeyCode == Enum.KeyCode.LeftShift or input.KeyCode == Enum.KeyCode.RightShift then
  28.             running = false
  29.             setSpeed()
  30.         end
  31.     end
  32. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement