Guest User

HCBB 9v9 Script

a guest
Jan 25th, 2023
11,747
1
Never
3
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.78 KB | None | 1 0
  1. local set = {
  2. AutoAimBat = false;
  3. AutoHitBat = true;
  4. WindupDist = 67;
  5. HitDist = 14;
  6. BallEsp = true;
  7. YOffset = -10;
  8. OnlyHitInBox = true;
  9. AimWithMouse = true;
  10. showBoundsAndPrediction = true;
  11. }
  12.  
  13. local function find_constant(func, sig)
  14. local s = "9271YE7DGWDAHSDBSSS"
  15. for i,v in ipairs(getconstants(func)) do
  16. if tostring(v):find(sig) then
  17. return true
  18. end
  19. end
  20. return false
  21. end
  22.  
  23. local theBall = nil;
  24. local tweenSpeed = 0
  25.  
  26. local Circle = Drawing.new("Circle")
  27. Circle.Visible = true
  28. Circle.Thickness = 2
  29. Circle.Radius = 10
  30. Circle.Color = Color3.new(0,255,0)
  31.  
  32.  
  33. local PredictionCircle = Drawing.new("Circle")
  34. PredictionCircle.Visible = true
  35. PredictionCircle.Thickness = 2
  36. PredictionCircle.Radius = 30
  37. PredictionCircle.Color = Color3.new(255,0,0)
  38. local InsidePredictionCircle = Drawing.new("Circle")
  39. InsidePredictionCircle.Visible = true
  40. InsidePredictionCircle.Thickness = 2
  41. InsidePredictionCircle.Filled = true
  42. InsidePredictionCircle.Transparency = 0.5
  43. InsidePredictionCircle.Radius = 30
  44. InsidePredictionCircle.Color = Color3.new(255,0,0)
  45.  
  46. local part = _G.Part or Instance.new("Part")
  47. _G.Part = part
  48. part.Anchored = true
  49. part.Size = Vector3.new(0.5,0.5,0.5)
  50. part.BrickColor = BrickColor.new("Really red")
  51. part.CanCollide = false
  52. part.Transparency = set.showBoundsAndPrediction and 0.35 or 1
  53. --part.Parent = workspace
  54.  
  55. local currentPathTable = {}
  56. local predictedPos = Vector3.new()
  57. local founditthing = false
  58.  
  59. local lastTick = 0
  60.  
  61. local old
  62. old = hookmetamethod(game, "__namecall", function(self, ...)
  63. if not checkcaller() and getnamecallmethod() == "Clone" and self and self.Parent and self.Parent.Name == "Ball" then
  64. if tick() > lastTick + 2 then
  65. lastTick = tick()
  66. theBall = self.Parent
  67. end
  68. end
  69.  
  70. return old(self, ...)
  71. end)
  72.  
  73. local camera = workspace.CurrentCamera
  74. for i,v in ipairs(getgc(true)) do
  75. if type(v) == 'function' and islclosure(v) and not (syn and is_synapse_function or Krnl and iskrnlclosure)(v) then
  76. if tostring(getfenv(v).script) == "GoFirst" then
  77. for a,c in pairs(getupvalues(v)) do
  78. if type(c) == 'function' and islclosure(c) and find_constant(c, "NextNumber") and (find_constant(c, "abs") or find_constant(c, "sin")) then
  79. setupvalue(v, a, function() return Vector3.new() end)
  80. end
  81. end
  82. end
  83. elseif type(v) == 'table' and rawget(v, "GetPos") then
  84. local old = v.SetPitchtab
  85. v["SetPitchtab"] = function(self, thingy)
  86. delay(0.1, function()
  87. if not workspace.Ignore:FindFirstChild("BGUI") then
  88. return
  89. end
  90. local borderBox = workspace.Ignore.BGUI.BlackBoarder
  91. local closestMag = math.huge
  92. local newPos = Vector3.new()
  93. for i = 0, 1, 0.01 do
  94. local pos = v:GetPos(i, currentPathTable, false, nil, thingy)
  95. if pos and pos.p ~= Vector3.new(0,0,0) then
  96. local mag = (pos.p - borderBox.Position).Magnitude
  97. if mag < closestMag then
  98. closestMag = mag
  99. newPos = pos.p
  100. end
  101. end
  102. end
  103. if newPos ~= Vector3.new() then
  104. PredictionCircle.Visible = set.showBoundsAndPrediction
  105. InsidePredictionCircle.Visible = set.showBoundsAndPrediction
  106. local pos, isInScreen = workspace.CurrentCamera:WorldToViewportPoint(newPos)
  107. PredictionCircle.Position = Vector2.new(pos.x, pos.y)
  108. InsidePredictionCircle.Position = Vector2.new(pos.x, pos.y)
  109.  
  110. --part.Position = newPos
  111. predictedPos = newPos
  112. else
  113. PredictionCircle.Visible = false
  114. InsidePredictionCircle.Visible = false
  115. end
  116. end)
  117. return old(self, thingy)
  118. end
  119. end
  120. end
  121.  
  122. game.ReplicatedStorage.RESC.SEVREPBALLTHROW.OnClientEvent:connect(function(_, p219)
  123. currentPathTable = p219
  124. end)
  125.  
  126. local mouse = game:GetService("Players").LocalPlayer:GetMouse()
  127. local smoothness = 1
  128. local toChange = nil
  129. local hasWindedUp = false
  130. local hasSwang = false
  131. local aiming = false
  132.  
  133. local tween
  134. local completedTween
  135.  
  136. function actuallyAim()
  137. if theBall ~= nil and theBall.Parent ~= nil then
  138. local toAimAt = theBall.Position
  139. if predictedPos and predictedPos ~= Vector3.new() then
  140. toAimAt = predictedPos
  141. end
  142. local ballPos = camera:WorldToScreenPoint(toAimAt + Vector3.new(0,-theBall.Size.Y/2,0))
  143. local mousePos = camera:WorldToScreenPoint(mouse.Hit.p)
  144. local aimAt = Vector2.new()
  145. local normalPos = Vector2.new(ballPos.X, ballPos.Y)
  146. local diff
  147. if toChange then
  148. local cursorV2 = camera:WorldToScreenPoint(toChange.Position + Vector3.new(0, toChange.Size.Y/2, 0))
  149. local myMousePos = Vector2.new(mousePos.X, mousePos.Y)
  150. local cursorPos = Vector2.new(cursorV2.X, cursorV2.Y)
  151.  
  152. local difference = (myMousePos - cursorPos)
  153. normalPos = normalPos + difference + Vector2.new(0, set.YOffset)
  154. diff = difference
  155. end
  156. aimAt = normalPos
  157.  
  158. local shouldAim = false
  159. if set.AutoHitBat then
  160. local toMag = workspace.Plates.SwingTarget.Position
  161. if predictedPos and predictedPos ~= Vector3.new() then
  162. toMag = predictedPos
  163. end
  164. local ballMag = (theBall.Position - toMag).Magnitude
  165. if ballMag <= set.WindupDist and not hasWindedUp then
  166. hasWindedUp = true
  167. mouse1click()
  168. end
  169. if hasWindedUp and not hasSwang then
  170. local borderBox = workspace.Ignore.BGUI.BlackBoarder
  171. local ballPos = camera:WorldToScreenPoint(toAimAt)
  172. local BorderPositions = {
  173. TopLeft = camera:WorldToScreenPoint(borderBox.Position + Vector3.new(0,borderBox.Size.Y/2 + 0.2 + 0.25,borderBox.Size.X/2 + 0.2+ 0.25)),
  174. TopRight = camera:WorldToScreenPoint(borderBox.Position + Vector3.new(0,borderBox.Size.Y/2 + 0.2+ 0.25,-borderBox.Size.X/2 - 0.2 - 0.25)),
  175. BottomRight = camera:WorldToScreenPoint(borderBox.Position + Vector3.new(0,-borderBox.Size.Y/2 - 0.2 - 0.25,-borderBox.Size.X/2 - 0.2 - 0.25)),
  176. BottomLeft = camera:WorldToScreenPoint(borderBox.Position + Vector3.new(0,-borderBox.Size.Y/2 - 0.2 - 0.25,borderBox.Size.X/2 + 0.2 + 0.25)),
  177. }
  178.  
  179. local parts = _G.parts or {
  180. TopLeft = Instance.new("Part"),
  181. TopRight = Instance.new("Part"),
  182. BottomLeft = Instance.new("Part"),
  183. BottomRight = Instance.new("Part")
  184. }
  185. _G.parts = parts
  186.  
  187. for i,v in pairs(parts) do
  188. v.Anchored = true
  189. v.CanCollide = false
  190. v.BrickColor = BrickColor.new("Cyan")
  191. v.Size = Vector3.new(0.25,0.25,0.25)
  192. v.Transparency = set.showBoundsAndPrediction and 0.1 or 1
  193. --v.Parent = workspace
  194. end
  195.  
  196. if set.showBoundsAndPrediction then
  197. _G.Part.Transparency = 0.35
  198. else
  199. _G.Part.Transparency = 1
  200. end
  201.  
  202. parts.TopLeft.Position = borderBox.Position + Vector3.new(0,borderBox.Size.Y/2 + 0.2 + 0.25,borderBox.Size.X/2 + 0.2 + 0.25)
  203. parts.TopRight.Position = borderBox.Position + Vector3.new(0,borderBox.Size.Y/2 + 0.2 + 0.25,-borderBox.Size.X/2 - 0.2 - 0.25)
  204. parts.BottomRight.Position = borderBox.Position + Vector3.new(0,-borderBox.Size.Y/2 - 0.2,-borderBox.Size.X/2 - 0.2 - 0.25)
  205. parts.BottomLeft.Position = borderBox.Position + Vector3.new(0,-borderBox.Size.Y/2 - 0.2,borderBox.Size.X/2 + 0.2 + 0.25)
  206.  
  207. --TopLeft
  208.  
  209.  
  210. if not set.OnlyHitInBox or (ballPos.X <= BorderPositions.TopRight.X and ballPos.X >= BorderPositions.TopLeft.X and ballPos.Y <= BorderPositions.BottomRight.Y and ballPos.Y >= BorderPositions.TopRight.Y) then
  211. shouldAim = true
  212. if ballMag <= set.HitDist then
  213. mouse1click()
  214. end
  215. end
  216.  
  217.  
  218.  
  219. hasSwang = true
  220.  
  221. delay(2, function()
  222. hasSwang = false
  223. hasWindedUp = false
  224. theBall = nil
  225. end)
  226. end
  227. end
  228.  
  229. if set.AimWithMouse and not aiming and theBall then
  230. aiming = true
  231. local CFValue = Instance.new("CFrameValue")
  232. CFValue.Value = CFrame.new(mousePos.X, mousePos.Y, 0)
  233. local con = true
  234. if tweenSpeed ~= 0 then
  235. tween = game:GetService("TweenService"):Create(CFValue, TweenInfo.new(tweenSpeed, Enum.EasingStyle.Quad), {Value = CFrame.new(aimAt.X, aimAt.Y, 0)})
  236. tween:Play()
  237.  
  238. completedTween = tween.Completed:Connect(function()
  239.  
  240. con = false
  241. delay(2, function()
  242. aiming = false
  243. end)
  244. end)
  245. theBall.Changed:Connect(function()
  246. if theBall and theBall.Parent then
  247. tween:Pause()
  248.  
  249. local toAimAt = theBall.Position
  250. if predictedPos and predictedPos ~= Vector3.new() then
  251. toAimAt = predictedPos
  252. end
  253. local ballPos = camera:WorldToScreenPoint(toAimAt + Vector3.new(0,-theBall.Size.Y/2,0))
  254. local mousePos = camera:WorldToScreenPoint(mouse.Hit.p)
  255. local aimAt = Vector2.new()
  256. local normalPos = Vector2.new(ballPos.X, ballPos.Y)
  257. local diff
  258. if toChange then
  259. local cursorV2 = camera:WorldToScreenPoint(toChange.Position + Vector3.new(0, toChange.Size.Y/2, 0))
  260. local myMousePos = Vector2.new(mousePos.X, mousePos.Y)
  261. local cursorPos = Vector2.new(cursorV2.X, cursorV2.Y)
  262.  
  263. local difference = (myMousePos - cursorPos)
  264. normalPos = normalPos + difference + Vector2.new(0, set.YOffset)
  265. diff = difference
  266. end
  267. aimAt = normalPos
  268.  
  269. tween = game:GetService("TweenService"):Create(CFValue, TweenInfo.new(tweenSpeed, Enum.EasingStyle.Quad), {Value = CFrame.new(aimAt.X, aimAt.Y, 0)})
  270. tween:Play()
  271.  
  272. completedTween:Disconnect()
  273. completedTween = tween.Completed:Connect(function()
  274. con = false
  275. delay(2, function()
  276. aiming = false
  277. end)
  278. end)
  279. end
  280. end)
  281. spawn(function()
  282. while con do
  283. task.wait()
  284. mousemoveabs(CFValue.Value.X, CFValue.Value.Y)
  285. end
  286. end)
  287. else
  288. aiming = false
  289. mousemoveabs(aimAt.X, aimAt.Y)
  290. mousemoverel(1,1)
  291. end
  292. end
  293. end
  294. end
  295.  
  296. local specialTable = {}
  297. for i,v in ipairs(getgc(true)) do
  298. if type(v) == 'table' and rawget(v, "CENT_VECTOR2_1") then
  299. specialTable = v
  300. end
  301. end
  302.  
  303. local Mouse, Backup = game.Players.LocalPlayer:GetMouse();
  304. Backup = hookmetamethod(Mouse, "__index", newcclosure(function(self, idx)
  305. if not checkcaller() and idx == "X" and theBall then
  306. local ballPos = camera:WorldToScreenPoint(theBall.Position)
  307. local offset = rawget(specialTable, "CENT_VECTOR2_1")
  308.  
  309. if offset and set.AutoAimBat then
  310. return ballPos.X - offset.X
  311. end
  312. end;
  313. if not checkcaller() and idx == "Y" and theBall then
  314. local ballPos = camera:WorldToScreenPoint(theBall.Position)
  315. local offset = rawget(specialTable, "CENT_VECTOR2_1")
  316. if offset and set.AutoAimBat then
  317. return ballPos.Y - offset.Y
  318. end
  319. end;
  320.  
  321. return Backup(self, idx);
  322. end));
  323.  
  324. local function setToChange(self)
  325. if self.ClassName == "Part" and self.Name ~= "Shad" and self.Name ~= "Self" and self.Name ~= "HitTracker" then
  326. self:GetPropertyChangedSignal("CFrame"):Connect(function()
  327. toChange = self
  328. end)
  329. end
  330. end
  331. for i,v in ipairs(workspace.Ignore:GetChildren()) do
  332. setToChange(v)
  333. end
  334. workspace.Ignore.ChildAdded:Connect(setToChange)
  335.  
  336. game:GetService("RunService").Heartbeat:connect(function()
  337. if theBall == nil or theBall.Parent == nil then
  338. Circle.Visible = false
  339. else
  340. actuallyAim()
  341. Circle.Visible = set.BallEsp
  342. local pos, isInScreen = workspace.CurrentCamera:WorldToViewportPoint(theBall.Position)
  343. Circle.Position = Vector2.new(pos.x, pos.y)
  344. end
  345. end)
  346.  
Advertisement
Comments
Add Comment
Please, Sign In to add comment