SK1R4_script

Roblox Bhop Script (localScript)

Jan 16th, 2025
326
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.29 KB | Gaming | 0 0
  1. local UserInputService = game:GetService("UserInputService")
  2. local RunService = game:GetService("RunService")
  3. local Player = game.Players.LocalPlayer
  4. local Character = Player.Character or Player.CharacterAdded:Wait()
  5. local Humanoid = Character:WaitForChild("Humanoid")
  6. local RootPart = Character:WaitForChild("HumanoidRootPart")
  7.  
  8. local boostWindow = 1
  9. local speedMultiplier = 1.15
  10. local maxSpeed = 200
  11. local baseGravity = workspace.Gravity
  12. local gravityReductionStep = 1
  13. local minGravity = 100
  14.  
  15. local currentSpeedBoost = 0
  16. local lastLandTime = 0
  17. local canBoost = false
  18. local direction = Vector3.new(0, 0, 0)
  19.  
  20. local function resetBoostAndGravity()
  21. currentSpeedBoost = 0
  22. canBoost = false
  23. workspace.Gravity = baseGravity
  24. end
  25.  
  26. local function onLanding()
  27. canBoost = true
  28. lastLandTime = tick()
  29. if workspace.Gravity > minGravity then
  30. workspace.Gravity = math.max(workspace.Gravity - gravityReductionStep, minGravity)
  31. end
  32. end
  33.  
  34. UserInputService.InputBegan:Connect(function(input, gameProcessed)
  35. if gameProcessed then return end
  36. if input.KeyCode == Enum.KeyCode.Space then
  37. local timeSinceLand = tick() - lastLandTime
  38. if canBoost and timeSinceLand <= boostWindow then
  39. local moveDirection = Humanoid.MoveDirection
  40. if moveDirection.Magnitude > 0 then
  41. local currentVelocity = RootPart.Velocity
  42. currentSpeedBoost = math.min(currentSpeedBoost * speedMultiplier + 10, maxSpeed)
  43. local boostVelocity = moveDirection.Unit * currentSpeedBoost
  44. RootPart.Velocity = Vector3.new(boostVelocity.X, currentVelocity.Y, boostVelocity.Z)
  45. direction = moveDirection.Unit
  46. else
  47. resetBoostAndGravity()
  48. end
  49. Humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
  50. canBoost = false
  51. else
  52. resetBoostAndGravity()
  53. end
  54. end
  55. end)
  56.  
  57. RunService.RenderStepped:Connect(function()
  58. if currentSpeedBoost > 0 then
  59. local moveDirection = Humanoid.MoveDirection
  60. if moveDirection.Magnitude > 0 then
  61. local currentVelocity = RootPart.Velocity
  62. local boostVelocity = direction * currentSpeedBoost
  63. RootPart.Velocity = Vector3.new(boostVelocity.X, currentVelocity.Y, boostVelocity.Z)
  64. else
  65. resetBoostAndGravity()
  66. end
  67. end
  68. end)
  69.  
  70. Humanoid.StateChanged:Connect(function(_, newState)
  71. if newState == Enum.HumanoidStateType.Landed then
  72. onLanding()
  73. end
  74. end)
  75.  
Advertisement
Add Comment
Please, Sign In to add comment