Advertisement
Legend_HandlesYT

speed

May 17th, 2021
5,667
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. ShiftHeld = false
  2. local gcheck = true
  3. urspeed = -1 -- The lower it is the faster. So don't worry about it being minus 1
  4.  
  5.  
  6. function ChangeFaster(inputObject, gameProcessedEvent)
  7. if inputObject.KeyCode == Enum.KeyCode.Minus and gameProcessedEvent == false then
  8. urspeed = urspeed - 0.1
  9. end
  10. end
  11.  
  12.  
  13.  
  14. function ChangeSlower(inputObject, gameProcessedEvent)
  15. if inputObject.KeyCode == Enum.KeyCode.Equals and gameProcessedEvent == false then
  16. urspeed = urspeed + 0.1
  17. end
  18. end
  19.  
  20.  
  21.  
  22. function GChecker(inputObject, gameProcessedEvent)
  23. if inputObject.KeyCode == Enum.KeyCode.K and gameProcessedEvent == false then
  24. if gcheck == false then
  25. gcheck = true
  26. elseif gcheck == true then
  27. gcheck = false
  28. end
  29.  
  30. end
  31. end
  32.  
  33. game:GetService("UserInputService").InputBegan:connect(GChecker)
  34.  
  35.  
  36.  
  37. function PressShift(inputObject,gameProcessedEvent)
  38. if inputObject.KeyCode == Enum.KeyCode.LeftShift and gameProcessedEvent == false and gcheck == true then
  39. ShiftHeld = true
  40. end
  41. end
  42.  
  43. function ReleaseShift(inputObject,gameProcessed)
  44. if inputObject.KeyCode == Enum.KeyCode.LeftShift then
  45. ShiftHeld = false
  46. end
  47. end
  48.  
  49. game:GetService("UserInputService").InputBegan:connect(PressShift)
  50. game:GetService("UserInputService").InputEnded:connect(ReleaseShift)
  51. game:GetService("UserInputService").InputBegan:connect(ChangeFaster)
  52. game:GetService("UserInputService").InputBegan:connect(ChangeSlower)
  53.  
  54.  
  55. game:GetService('RunService').Stepped:connect(function()
  56. if ShiftHeld == true then
  57. game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame * CFrame.new(0,0,urspeed)
  58. end
  59. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement