ColdSpecs

Ask Ai (How does this know i have the ball)

Nov 2nd, 2025
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.86 KB | None | 0 0
  1. --// ======================================================================
  2. --// PAYLOAD0 • AUTO-AIM + ALIGN-ASSIST SYSTEM [UPDATED REMOTE VERSION]
  3. --// • Auto-locks nearest visible rim
  4. --// • Smart aim + push assist
  5. --// • Uses workspace.Basketball.shoot_event (new structure)
  6. --// • Captures shootKey automatically when detected
  7. --// • Works only when holding a ball
  8. --// ======================================================================
  9.  
  10. -- === SERVICES ===
  11. local Players = game:GetService('Players')
  12. local UserInputService = game:GetService('UserInputService')
  13. local RunService = game:GetService('RunService')
  14. local ReplicatedStorage = game:GetService('ReplicatedStorage')
  15. local CoreGui = game:GetService('CoreGui')
  16. local TweenService = game:GetService('TweenService')
  17. local Workspace = game:GetService('Workspace')
  18. local Camera = Workspace.CurrentCamera
  19.  
  20. local plr = Players.LocalPlayer
  21. local char = plr.Character or plr.CharacterAdded:Wait()
  22.  
  23. -- === REMOTE ===
  24. local Basketball = Workspace:WaitForChild('Basketball')
  25. local shootRemote = Basketball:WaitForChild('shoot_event')
  26.  
  27. -- === STATE ===
  28. getgenv().PAYLOAD0_SYSTEM_ACTIVE = true
  29. local VisualsEnabled = true
  30. local shootKey: string? = nil
  31. local selectedRim: BasePart? = nil
  32. local activeNotifyGui
  33.  
  34. -- === CONFIGURATION ===
  35. local PERFECT_DISTANCES = { 54.97, 61.53, 68.10 }
  36. local CLAMP_RADIUS = 1
  37. local ACTIVE_RANGE_MAIN = 90
  38. local MAX_PUSH = 0.06
  39. local DAMPING = 0.9
  40.  
  41. local COLOR_GREEN = Color3.fromRGB(0, 255, 100)
  42. local COLOR_GREEN_SOFT = Color3.fromRGB(0, 200, 80)
  43.  
  44. -- === HELPER: BALL CHECK ===
  45. local function hasBall()
  46. local char = plr.Character
  47. if not char then
  48. return false
  49. end
  50. for _, tool in ipairs(char:GetChildren()) do
  51. if tool:IsA('Tool') and tool.Name:lower():find('ball') then
  52. return true
  53. end
  54. end
  55. return false
  56. end
  57.  
  58. -- === NOTIFY SYSTEM ===
  59. local function notify(msg, color)
  60. if activeNotifyGui and activeNotifyGui.Parent then
  61. activeNotifyGui:Destroy()
  62. end
  63. local gui = Instance.new('ScreenGui', CoreGui)
  64. gui.ResetOnSpawn = false
  65. activeNotifyGui = gui
  66.  
  67. local label = Instance.new('TextLabel', gui)
  68. label.AnchorPoint = Vector2.new(0.5, 0.5)
  69. label.BackgroundTransparency = 1
  70. label.TextColor3 = color or Color3.fromRGB(255, 255, 255)
  71. label.Font = Enum.Font.Code
  72. label.TextSize = 26
  73. label.Text = msg
  74. label.Position = UDim2.new(0.5, 0, 0.9, 0)
  75.  
  76. task.spawn(function()
  77. task.wait(1.2)
  78. if gui == activeNotifyGui then
  79. gui:Destroy()
  80. activeNotifyGui = nil
  81. end
  82. end)
  83. end
  84.  
  85. -- === CALIBRATE UI ===
  86. local calibrateGui
  87. local function showCalibrateUI()
  88. if calibrateGui or shootKey or not hasBall() then
  89. return
  90. end
  91.  
  92. calibrateGui = Instance.new('ScreenGui', CoreGui)
  93. calibrateGui.Name = 'CalibrateReminder'
  94. calibrateGui.ResetOnSpawn = false
  95. calibrateGui.IgnoreGuiInset = true
  96.  
  97. local frame = Instance.new('Frame', calibrateGui)
  98. frame.AnchorPoint = Vector2.new(0.5, 0.5)
  99. frame.Position = UDim2.new(0.5, 0, 0.85, 0)
  100. frame.Size = UDim2.new(0, 420, 0, 45)
  101. frame.BackgroundTransparency = 0.3
  102. frame.BackgroundColor3 = Color3.fromRGB(20, 20, 20)
  103. frame.BorderSizePixel = 0
  104.  
  105. local stroke = Instance.new('UIStroke', frame)
  106. stroke.Color = Color3.fromRGB(80, 255, 120)
  107. stroke.Thickness = 1.6
  108.  
  109. local corner = Instance.new('UICorner', frame)
  110. corner.CornerRadius = UDim.new(0, 10)
  111.  
  112. local label = Instance.new('TextLabel', frame)
  113. label.BackgroundTransparency = 1
  114. label.Size = UDim2.new(1, 0, 1, 0)
  115. label.Font = Enum.Font.GothamMedium
  116. label.TextSize = 22
  117. label.TextColor3 = Color3.fromRGB(120, 255, 150)
  118. label.Text = '🏀 Click once to calibrate your shot.'
  119.  
  120. task.spawn(function()
  121. while calibrateGui and not shootKey and hasBall() do
  122. local t1 = TweenService:Create(
  123. label,
  124. TweenInfo.new(0.8),
  125. { TextTransparency = 0.3 }
  126. )
  127. local t2 = TweenService:Create(
  128. label,
  129. TweenInfo.new(0.8),
  130. { TextTransparency = 0 }
  131. )
  132. t1:Play()
  133. t1.Completed:Wait()
  134. t2:Play()
  135. t2.Completed:Wait()
  136. end
  137. end)
  138. end
  139.  
  140. local function removeCalibrateUI()
  141. if calibrateGui then
  142. calibrateGui:Destroy()
  143. calibrateGui = nil
  144. end
  145. end
  146.  
  147. task.spawn(function()
  148. while task.wait(0.5) do
  149. if not hasBall() or shootKey then
  150. removeCalibrateUI()
  151. else
  152. showCalibrateUI()
  153. end
  154. end
  155. end)
  156.  
  157. -- === RIM TRACKING ===
  158. local RimSize =
  159. Vector3.new(3.632131576538086, 0.5587897300720215, 3.632131576538086)
  160. local Rims = {}
  161.  
  162. local function registerRim(v)
  163. if v:IsA('BasePart') and v.Name == 'Rim' and v.Size == RimSize then
  164. table.insert(Rims, v)
  165. end
  166. end
  167.  
  168. for _, v in ipairs(Workspace:GetDescendants()) do
  169. registerRim(v)
  170. end
  171.  
  172. Workspace.DescendantAdded:Connect(registerRim)
  173. Workspace.DescendantRemoving:Connect(function(o)
  174. for i, rim in ipairs(Rims) do
  175. if rim == o then
  176. table.remove(Rims, i)
  177. break
  178. end
  179. end
  180. if selectedRim == o then
  181. selectedRim = nil
  182. end
  183. end)
  184.  
  185. -- === AUTO RIM LOCK ===
  186. task.spawn(function()
  187. while task.wait(0.1) do
  188. if not getgenv().PAYLOAD0_SYSTEM_ACTIVE then
  189. continue
  190. end
  191. local root = plr.Character
  192. and plr.Character:FindFirstChild('HumanoidRootPart')
  193. if not root then
  194. continue
  195. end
  196.  
  197. local bestRim, bestDist = nil, 85
  198. for _, rim in ipairs(Rims) do
  199. if rim:IsDescendantOf(Workspace) then
  200. local dist = (rim.Position - root.Position).Magnitude
  201. if dist < bestDist then
  202. local _, on = Camera:WorldToViewportPoint(rim.Position)
  203. if on then
  204. bestRim, bestDist = rim, dist
  205. end
  206. end
  207. end
  208. end
  209. if bestRim and bestRim ~= selectedRim then
  210. selectedRim = bestRim
  211. end
  212. end
  213. end)
  214.  
  215. -- === TOGGLES ===
  216. UserInputService.InputBegan:Connect(function(i, gp)
  217. if gp then
  218. return
  219. end
  220. if i.KeyCode == Enum.KeyCode.O then
  221. VisualsEnabled = not VisualsEnabled
  222. notify(
  223. VisualsEnabled and '👁 Visuals ON' or '🙈 Visuals OFF',
  224. VisualsEnabled and COLOR_GREEN or Color3.fromRGB(255, 80, 80)
  225. )
  226. end
  227. if i.KeyCode == Enum.KeyCode.V then
  228. getgenv().PAYLOAD0_SYSTEM_ACTIVE = not getgenv().PAYLOAD0_SYSTEM_ACTIVE
  229. notify(
  230. getgenv().PAYLOAD0_SYSTEM_ACTIVE and '✅ System ON'
  231. or '🚫 System OFF',
  232. getgenv().PAYLOAD0_SYSTEM_ACTIVE and COLOR_GREEN
  233. or Color3.fromRGB(255, 80, 80)
  234. )
  235. end
  236. end)
  237.  
  238. -- === SHOOT REMOTE CAPTURE ===
  239. local old
  240. old = hookmetamethod(game, '__namecall', function(self, ...)
  241. local m = getnamecallmethod()
  242. if m == 'FireServer' and self == shootRemote then
  243. local args = { ... }
  244. if type(args[3]) == 'string' and not shootKey then
  245. shootKey = args[3]
  246. removeCalibrateUI()
  247. notify('Shoot key captured!', COLOR_GREEN)
  248. end
  249. end
  250. return old(self, ...)
  251. end)
  252.  
  253. -- === SMART AIM ===
  254. local function computeOffset()
  255. local hum = plr.Character
  256. and plr.Character:FindFirstChildOfClass('Humanoid')
  257. local moveDir = (hum and hum.MoveDirection) or Vector3.zero
  258. return Vector3.new(moveDir.X * 1.5, 0, moveDir.Z * 1.5)
  259. end
  260.  
  261. local function computeArc(dist)
  262. return Vector3.new(0, 43 + (dist / 15), 0)
  263. end
  264.  
  265. local function smartAim(rim)
  266. local root = plr.Character
  267. and plr.Character:FindFirstChild('HumanoidRootPart')
  268. if not root then
  269. return rim.Position
  270. end
  271. local dist = (root.Position - rim.Position).Magnitude
  272. return rim.Position + computeArc(dist) - computeOffset()
  273. end
  274.  
  275. -- === SHOOT FUNCTION (NEW STRUCTURE) ===
  276. local vector = getfenv().vector or {}
  277. vector.create = vector.create or Vector3.new
  278.  
  279. local function shootAtTarget()
  280. if not getgenv().PAYLOAD0_SYSTEM_ACTIVE then
  281. return
  282. end
  283. if not (selectedRim and selectedRim:IsDescendantOf(Workspace)) then
  284. return
  285. end
  286. if not hasBall() or not shootKey then
  287. return
  288. end
  289.  
  290. local char = plr.Character
  291. local head, root =
  292. char and char:FindFirstChild('Head'),
  293. char and char:FindFirstChild('HumanoidRootPart')
  294. if not (head and root) then
  295. return
  296. end
  297.  
  298. local aimPos = smartAim(selectedRim)
  299. local dir = (aimPos - head.Position).Unit
  300. local shootFrom = root.Position + dir * 3.8
  301.  
  302. -- Construct args for the new shoot_event format
  303. local args = {
  304. vector.create(aimPos.X, aimPos.Y, aimPos.Z), -- aim position
  305. vector.create(shootFrom.X, shootFrom.Y, shootFrom.Z), -- from
  306. shootKey, -- shootKey emoji
  307. Instance.new('Tool', nil), -- dummy Tool
  308. 35, -- power
  309. {
  310. CFrame.new(root.CFrame:GetComponents()),
  311. CFrame.new(aimPos),
  312. 70,
  313. Vector2.new(1280, 737.5),
  314. },
  315. true,
  316. }
  317. shootRemote:FireServer(unpack(args))
  318. end
  319.  
  320. -- === FIRE ON CLICK ===
  321. UserInputService.InputBegan:Connect(function(i, gp)
  322. if gp or not getgenv().PAYLOAD0_SYSTEM_ACTIVE then
  323. return
  324. end
  325. if i.UserInputType == Enum.UserInputType.MouseButton1 and hasBall() then
  326. shootAtTarget()
  327. end
  328. end)
  329.  
  330. -- === VISUAL HIGHLIGHT ===
  331. local hl = CoreGui:FindFirstChild('PerfectRangeGlow')
  332. or Instance.new('Highlight')
  333. hl.Name = 'PerfectRangeGlow'
  334. hl.DepthMode = Enum.HighlightDepthMode.AlwaysOnTop
  335. hl.FillTransparency = 0.25
  336. hl.OutlineTransparency = 0
  337. hl.Adornee = plr.Character
  338. hl.Parent = CoreGui
  339. hl.Enabled = false
  340.  
  341. -- === LIVE UPDATE ===
  342. RunService.RenderStepped:Connect(function()
  343. if not getgenv().PAYLOAD0_SYSTEM_ACTIVE then
  344. hl.Enabled = false
  345. return
  346. end
  347. if not hasBall() then
  348. hl.Enabled = false
  349. return
  350. end
  351. local char = plr.Character
  352. local root = char and char:FindFirstChild('HumanoidRootPart')
  353. if not root or not selectedRim then
  354. hl.Enabled = false
  355. return
  356. end
  357.  
  358. local dist = (selectedRim.Position - root.Position).Magnitude
  359. local near = math.abs(dist - PERFECT_DISTANCES[1]) < 1
  360. if VisualsEnabled and near then
  361. hl.Enabled = true
  362. hl.FillColor, hl.OutlineColor = COLOR_GREEN, COLOR_GREEN
  363. else
  364. hl.Enabled = false
  365. end
  366. end)
  367.  
  368. plr.CharacterAdded:Connect(function(c)
  369. task.wait(0.5)
  370. hl.Adornee = c
  371. end)
  372.  
Advertisement
Add Comment
Please, Sign In to add comment