Advertisement
baconkingiscool

blade ball script :D

Oct 10th, 2023 (edited)
6,334
0
Never
2
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.25 KB | None | 0 0
  1. local Rayfield = loadstring(game:HttpGet('https://sirius.menu/rayfield'))()
  2.  
  3. local workspace = game:GetService("Workspace")
  4. local players = game:GetService("Players")
  5. local localPlayer = players.LocalPlayer
  6. local UserInputService = game:GetService("UserInputService")
  7. local replicatedStorage = game:GetService("ReplicatedStorage")
  8. local heartbeatConnection
  9.  
  10. local Window = Rayfield:CreateWindow({
  11. Name = "Blade Ball",
  12. LoadingTitle = "Baconking",
  13. LoadingSubtitle = "by baconking",
  14. ConfigurationSaving = {
  15. Enabled = false,
  16. FolderName = "Inferno Scripts",
  17. FileName = "Inferno Scripts"
  18. },
  19. Discord = {
  20. Enabled = true,
  21. Invite = "hNX8VxcjMF",
  22. RememberJoins = true
  23. },
  24. KeySystem = false,
  25. KeySettings = {
  26. Title = "Inferno Scripts",
  27. Subtitle = "Key System",
  28. Note = "Join the discord (discord.gg/hNX8VxcjMF)",
  29. FileName = "InfernoKey",
  30. SaveKey = true,
  31. GrabKeyFromSite = false,
  32. Key = "Hello"
  33. }
  34. })
  35.  
  36. local AutoParry = Window:CreateTab("Auto Parry", 13014537525)
  37.  
  38. local function startAutoParry()
  39. local player = game.Players.LocalPlayer
  40. local character = player.Character or player.CharacterAdded:Wait()
  41. local replicatedStorage = game:GetService("ReplicatedStorage")
  42. local runService = game:GetService("RunService")
  43. local parryButtonPress = replicatedStorage.Remotes.ParryButtonPress
  44. local ballsFolder = workspace:WaitForChild("Balls")
  45.  
  46. print("Script successfully ran.")
  47.  
  48. local function onCharacterAdded(newCharacter)
  49. character = newCharacter
  50. end
  51.  
  52. player.CharacterAdded:Connect(onCharacterAdded)
  53.  
  54. local focusedBall = nil
  55.  
  56. local function chooseNewFocusedBall()
  57. local balls = ballsFolder:GetChildren()
  58. focusedBall = nil
  59. for _, ball in ipairs(balls) do
  60. if ball:GetAttribute("realBall") == true then
  61. focusedBall = ball
  62. break
  63. end
  64. end
  65. end
  66.  
  67. chooseNewFocusedBall()
  68.  
  69. local function timeUntilImpact(ballVelocity, distanceToPlayer, playerVelocity)
  70. local directionToPlayer = (character.HumanoidRootPart.Position - focusedBall.Position).Unit
  71. local velocityTowardsPlayer = ballVelocity:Dot(directionToPlayer) - playerVelocity:Dot(directionToPlayer)
  72.  
  73. if velocityTowardsPlayer <= 0 then
  74. return math.huge
  75. end
  76.  
  77. local distanceToBeCovered = distanceToPlayer - 20
  78. return distanceToBeCovered / velocityTowardsPlayer
  79. end
  80.  
  81. local BASE_THRESHOLD = 0.15
  82. local VELOCITY_SCALING_FACTOR = 0.002
  83.  
  84. local function getDynamicThreshold(ballVelocityMagnitude)
  85. local adjustedThreshold = BASE_THRESHOLD - (ballVelocityMagnitude * VELOCITY_SCALING_FACTOR)
  86. return math.max(0.12, adjustedThreshold)
  87. end
  88.  
  89. local function checkBallDistance()
  90. if not character:FindFirstChild("Highlight") then return end
  91. local charPos = character.PrimaryPart.Position
  92. local charVel = character.PrimaryPart.Velocity
  93.  
  94. if focusedBall and not focusedBall.Parent then
  95. chooseNewFocusedBall()
  96. end
  97.  
  98. if not focusedBall then return end
  99.  
  100. local ball = focusedBall
  101. local distanceToPlayer = (ball.Position - charPos).Magnitude
  102.  
  103. if distanceToPlayer < 10 then
  104. parryButtonPress:Fire()
  105. return
  106. end
  107.  
  108. local timeToImpact = timeUntilImpact(ball.Velocity, distanceToPlayer, charVel)
  109. local dynamicThreshold = getDynamicThreshold(ball.Velocity.Magnitude)
  110.  
  111. if timeToImpact < dynamicThreshold then
  112. parryButtonPress:Fire()
  113. end
  114. end
  115. heartbeatConnection = game:GetService("RunService").Heartbeat:Connect(function()
  116. checkBallDistance()
  117. end)
  118. end
  119.  
  120. local function stopAutoParry()
  121. if heartbeatConnection then
  122. heartbeatConnection:Disconnect()
  123. heartbeatConnection = nil
  124. end
  125. end
  126.  
  127. local AutoParryToggle = AutoParry:CreateToggle({
  128. Name = "Auto Parry",
  129. CurrentValue = false,
  130. Flag = "AutoParryFlag",
  131. Callback = function(value)
  132. if Value then
  133. startAutoParry()
  134. else
  135. stopAutoParry()
  136. end
  137. end,
  138. })
Advertisement
Comments
Add Comment
Please, Sign In to add comment
Advertisement