Advertisement
Adel987654321

Press Q For Speed

Dec 6th, 2019
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. --This may be a little buggy, so beware.
  2. --Hold "Q" to speed up
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9. down = false
  10. velocity = Instance.new("BodyVelocity")
  11. velocity.maxForce = Vector3.new(100000, 0, 100000)
  12. ---vv Use that to change the speed v
  13. local speed = 150
  14. gyro = Instance.new("BodyGyro")
  15. gyro.maxTorque = Vector3.new(100000, 0, 100000)
  16.  
  17. local hum = game.Players.LocalPlayer.Character.Humanoid
  18.  
  19. function onButton1Down(mouse)
  20. down = true
  21. velocity.Parent = game.Players.LocalPlayer.Character.UpperTorso
  22. velocity.velocity = (hum.MoveDirection) * speed
  23. gyro.Parent = game.Players.LocalPlayer.Character.UpperTorso
  24. while down do
  25. if not down then break end
  26. velocity.velocity = (hum.MoveDirection) * speed
  27. local refpos = gyro.Parent.Position + (gyro.Parent.Position - workspace.CurrentCamera.CoordinateFrame.p).unit * 5
  28. gyro.cframe = CFrame.new(gyro.Parent.Position, Vector3.new(refpos.x, gyro.Parent.Position.y, refpos.z))
  29. wait(0.1)
  30. end
  31. end
  32.  
  33. function onButton1Up(mouse)
  34. velocity.Parent = nil
  35. gyro.Parent = nil
  36. down = false
  37. end
  38. --To Change the key in those 2 lines, replace the "q" with your desired key
  39. function onSelected(mouse)
  40. mouse.KeyDown:connect(function(k) if k:lower()=="q"then onButton1Down(mouse)end end)
  41. mouse.KeyUp:connect(function(k) if k:lower()=="q"then onButton1Up(mouse)end end)
  42. end
  43.  
  44. onSelected(game.Players.LocalPlayer:GetMouse())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement