ColdSpecs

Push + Power (But power is not perfectly sync)

Nov 2nd, 2025
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.55 KB | None | 0 0
  1. --// ======================================================================
  2. --// PAYLOAD0 • AUTO-AIM + ALIGN-ASSIST [STATIC RIMSIZE + AUTO POWER]
  3. --// • Static RimSize detection (no "Lol" parts)
  4. --// • Dynamic power learning: remote arg#5 + tool attributes/values
  5. --// • A/D single-key push with soft pull even slightly outside clamp radius
  6. --// • Bright green visuals when ball equipped & near target band
  7. --// • Calibration UI (until shoot key is captured)
  8. --// • Toggles: [O]=Visuals, [V]=System, LMB=Shoot
  9. --// ======================================================================
  10.  
  11. -- === SERVICES ===
  12. local Players = game:GetService('Players')
  13. local UserInputService = game:GetService('UserInputService')
  14. local RunService = game:GetService('RunService')
  15. local ReplicatedStorage = game:GetService('ReplicatedStorage')
  16. local CoreGui = game:GetService('CoreGui')
  17. local TweenService = game:GetService('TweenService')
  18. local Workspace = game:GetService('Workspace')
  19. local Camera = workspace.CurrentCamera
  20.  
  21. local plr = Players.LocalPlayer
  22. local char = plr.Character or plr.CharacterAdded:Wait()
  23.  
  24. -- === STATE ===
  25. getgenv().PAYLOAD0_SYSTEM_ACTIVE = true
  26. local VisualsEnabled = true
  27. local shootKey : string? = nil
  28. local selectedRim : BasePart? = nil
  29. local activeNotifyGui
  30. local ballTool : Tool? = nil
  31.  
  32. -- === CONFIGURATION ===
  33. local PERFECT_DISTANCES = { 54.97, 61.53, 68.10 }
  34. local CLAMP_RADIUS = 1 -- hard target band
  35. local SOFT_RADIUS = CLAMP_RADIUS * 2 -- gentle pull band (outside clamp)
  36. local ACTIVE_RANGE_MAIN = 90
  37. local MAX_PUSH = 0.06
  38. local DAMPING = 0.9
  39. local COLOR_GREEN = Color3.fromRGB(0, 255, 100)
  40. local COLOR_GREEN_SOFT = Color3.fromRGB(0, 200, 80)
  41.  
  42. -- === NOTIFY SYSTEM ===
  43. local function notify(msg, color)
  44. if activeNotifyGui and activeNotifyGui.Parent then
  45. activeNotifyGui:Destroy()
  46. end
  47. local gui = Instance.new('ScreenGui')
  48. gui.ResetOnSpawn = false
  49. gui.Parent = CoreGui
  50. activeNotifyGui = gui
  51.  
  52. local label = Instance.new('TextLabel')
  53. label.AnchorPoint = Vector2.new(0.5, 0.5)
  54. label.BackgroundTransparency = 1
  55. label.TextColor3 = color or Color3.fromRGB(255, 255, 255)
  56. label.Font = Enum.Font.Code
  57. label.TextSize = 26
  58. label.Text = msg
  59. label.Position = UDim2.new(0.5, 0, 0.9, 0)
  60. label.Parent = gui
  61.  
  62. task.spawn(function()
  63. task.wait(1.2)
  64. if gui == activeNotifyGui then
  65. gui:Destroy()
  66. activeNotifyGui = nil
  67. end
  68. end)
  69. end
  70.  
  71. -- === HELPER: BALL CHECK ===
  72. local function hasBall()
  73. local c = plr.Character
  74. if not c then return false end
  75. for _, tool in ipairs(c:GetChildren()) do
  76. if tool:IsA('Tool') and tool.Name:lower():find('ball') then
  77. ballTool = tool
  78. return true
  79. end
  80. end
  81. ballTool = nil
  82. return false
  83. end
  84.  
  85. -- === CALIBRATE UI ===
  86. local calibrateGui
  87. local function showCalibrateUI()
  88. if calibrateGui or shootKey or not hasBall() then return end
  89. calibrateGui = Instance.new('ScreenGui')
  90. calibrateGui.Name = 'CalibrateReminder'
  91. calibrateGui.ResetOnSpawn = false
  92. calibrateGui.IgnoreGuiInset = true
  93. calibrateGui.Parent = CoreGui
  94.  
  95. local frame = Instance.new('Frame')
  96. frame.AnchorPoint = Vector2.new(0.5, 0.5)
  97. frame.Position = UDim2.new(0.5, 0, 0.85, 0)
  98. frame.Size = UDim2.new(0, 420, 0, 45)
  99. frame.BackgroundTransparency = 0.3
  100. frame.BackgroundColor3 = Color3.fromRGB(20, 20, 20)
  101. frame.BorderSizePixel = 0
  102. frame.Parent = calibrateGui
  103.  
  104. local stroke = Instance.new('UIStroke')
  105. stroke.Color = Color3.fromRGB(80, 255, 120)
  106. stroke.Thickness = 1.6
  107. stroke.Parent = frame
  108.  
  109. local corner = Instance.new('UICorner')
  110. corner.CornerRadius = UDim.new(0, 10)
  111. corner.Parent = frame
  112.  
  113. local label = Instance.new('TextLabel')
  114. label.BackgroundTransparency = 1
  115. label.Size = UDim2.new(1, 0, 1, 0)
  116. label.Font = Enum.Font.GothamMedium
  117. label.TextSize = 22
  118. label.TextColor3 = Color3.fromRGB(120, 255, 150)
  119. label.Text = '🏀 Click once to calibrate your shot.'
  120. label.Parent = frame
  121.  
  122. task.spawn(function()
  123. while calibrateGui and not shootKey and hasBall() do
  124. local t1 = TweenService:Create(label, TweenInfo.new(0.8, Enum.EasingStyle.Sine), {TextTransparency = 0.3})
  125. local t2 = TweenService:Create(label, TweenInfo.new(0.8, Enum.EasingStyle.Sine), {TextTransparency = 0})
  126. t1:Play(); t1.Completed:Wait()
  127. t2:Play(); t2.Completed:Wait()
  128. end
  129. end)
  130. end
  131.  
  132. local function removeCalibrateUI()
  133. if calibrateGui then calibrateGui:Destroy(); calibrateGui = nil end
  134. end
  135.  
  136. task.spawn(function()
  137. while task.wait(0.5) do
  138. if not hasBall() or shootKey then removeCalibrateUI() else showCalibrateUI() end
  139. end
  140. end)
  141.  
  142. -- === AUTO POWER SYSTEM ===
  143. local CURRENT_POWER = 75
  144. local POWER_NAMES = { "Power", "ShootPower", "ShotPower", "Shot_Strength", "ShotPowerValue" }
  145.  
  146. local function setPower(p)
  147. if typeof(p) == "number" and p > 0 and p < 1000 then
  148. CURRENT_POWER = p
  149. end
  150. end
  151.  
  152. local function attachPowerWatchersToTool(tool)
  153. if not tool then return end
  154. for _, name in ipairs(POWER_NAMES) do
  155. if tool:GetAttribute(name) ~= nil then
  156. setPower(tool:GetAttribute(name))
  157. end
  158. tool:GetAttributeChangedSignal(name):Connect(function()
  159. setPower(tool:GetAttribute(name))
  160. end)
  161. end
  162. for _, obj in ipairs(tool:GetDescendants()) do
  163. if obj:IsA("NumberValue") and table.find(POWER_NAMES, obj.Name) then
  164. setPower(obj.Value)
  165. obj:GetPropertyChangedSignal("Value"):Connect(function()
  166. setPower(obj.Value)
  167. end)
  168. end
  169. end
  170. tool.DescendantAdded:Connect(function(obj)
  171. if obj:IsA("NumberValue") and table.find(POWER_NAMES, obj.Name) then
  172. setPower(obj.Value)
  173. obj:GetPropertyChangedSignal("Value"):Connect(function()
  174. setPower(obj.Value)
  175. end)
  176. end
  177. end)
  178. end
  179.  
  180. local _orig_hasBall = hasBall
  181. hasBall = function()
  182. local ok = _orig_hasBall()
  183. if ok and ballTool then
  184. attachPowerWatchersToTool(ballTool)
  185. end
  186. return ok
  187. end
  188.  
  189. -- === REMOTE HOOK ===
  190. local shootRemote : RemoteEvent? = nil
  191. local hookedMeta = nil
  192. local SEARCH_PATTERN = 'shoot'
  193.  
  194. local function getRoots()
  195. local roots = {}
  196. local userFolder = Workspace:FindFirstChild(plr.Name)
  197. if userFolder and userFolder:FindFirstChild('Basketball') then
  198. table.insert(roots, userFolder.Basketball)
  199. end
  200. local iso = Workspace:FindFirstChild('isokcocs')
  201. if iso and iso:FindFirstChild('Basketball') then
  202. table.insert(roots, iso.Basketball)
  203. end
  204. local remotes = ReplicatedStorage:FindFirstChild('Remotes')
  205. if remotes then table.insert(roots, remotes) end
  206. return roots
  207. end
  208.  
  209. local function findShootRemote()
  210. for _, root in ipairs(getRoots()) do
  211. for _, obj in ipairs(root:GetDescendants()) do
  212. if obj:IsA('RemoteEvent') and obj.Name:lower():find(SEARCH_PATTERN) then
  213. return obj
  214. end
  215. end
  216. local direct = root:FindFirstChild('Shoot')
  217. if direct and direct:IsA('RemoteEvent') then
  218. return direct
  219. end
  220. end
  221. return nil
  222. end
  223.  
  224. local function hookRemote(remote)
  225. if hookedMeta then return end
  226. local old
  227. old = hookmetamethod(game, '__namecall', function(self, ...)
  228. local m = getnamecallmethod()
  229. if m == 'FireServer' and self == remote then
  230. local args = {...}
  231. if type(args[3]) == 'string' and not shootKey then
  232. shootKey = args[3]
  233. removeCalibrateUI()
  234. pcall(function() notify('Shoot key captured: '..shootKey, COLOR_GREEN) end)
  235. end
  236. if type(args[5]) == "number" then
  237. setPower(args[5])
  238. end
  239. end
  240. return old(self, ...)
  241. end)
  242. hookedMeta = old
  243. shootRemote = remote
  244. pcall(function() notify('Remote locked: '..remote:GetFullName(), COLOR_GREEN) end)
  245. end
  246.  
  247. local function unhookRemote()
  248. hookedMeta = nil
  249. shootRemote = nil
  250. end
  251.  
  252. RunService.Heartbeat:Connect(function()
  253. if not getgenv().PAYLOAD0_SYSTEM_ACTIVE then return end
  254. local current = findShootRemote()
  255. if current then
  256. if current ~= shootRemote then
  257. unhookRemote()
  258. hookRemote(current)
  259. end
  260. elseif shootRemote then
  261. unhookRemote()
  262. end
  263. end)
  264.  
  265. -- === STATIC RIM DETECTION ===
  266. local RimSize = Vector3.new(3.632131576538086, 0.5587897300720215, 3.632131576538086)
  267. local Rims = {}
  268.  
  269. for _, v in ipairs(Workspace:GetDescendants()) do
  270. if v:IsA('BasePart') and v.Name == 'Rim' and v.Size == RimSize then
  271. table.insert(Rims, v)
  272. end
  273. end
  274.  
  275. Workspace.DescendantAdded:Connect(function(o)
  276. if o:IsA('BasePart') and o.Name == 'Rim' and o.Size == RimSize then
  277. table.insert(Rims, o)
  278. end
  279. end)
  280.  
  281. Workspace.DescendantRemoving:Connect(function(o)
  282. for i, rim in ipairs(Rims) do
  283. if rim == o then table.remove(Rims, i); break end
  284. end
  285. if selectedRim == o then selectedRim = nil end
  286. end)
  287.  
  288. local function nearestRim(rootPos)
  289. local nearest, nearestDist
  290. for _, rim in ipairs(Rims) do
  291. if rim:IsDescendantOf(Workspace) then
  292. local rimXZ = Vector3.new(rim.Position.X, 0, rim.Position.Z)
  293. local dist = (rimXZ - Vector3.new(rootPos.X, 0, rootPos.Z)).Magnitude
  294. if not nearestDist or dist < nearestDist then
  295. nearest, nearestDist = rim, dist
  296. end
  297. end
  298. end
  299. return nearest, nearestDist
  300. end
  301.  
  302. local function getNearestPerfectDistance(current)
  303. local nearest, smallestDiff
  304. for _, pd in ipairs(PERFECT_DISTANCES) do
  305. local diff = math.abs(pd - current)
  306. if not smallestDiff or diff < smallestDiff then
  307. nearest, smallestDiff = pd, diff
  308. end
  309. end
  310. return nearest
  311. end
  312.  
  313. -- === SHOOT LOGIC ===
  314. local lastTick, moveOffset = 0, Vector3.zero
  315. local function computeOffset()
  316. if tick() - lastTick > 0.1 then
  317. local hum = plr.Character and plr.Character:FindFirstChildOfClass('Humanoid')
  318. local moveDir = (hum and hum.MoveDirection) or Vector3.zero
  319. moveOffset = Vector3.new(moveDir.X * 1.5, 0, moveDir.Z * 1.5)
  320. lastTick = tick()
  321. end
  322. return moveOffset
  323. end
  324.  
  325. local function computeArc(dist) return Vector3.new(0, 43 + (dist / 15), 0) end
  326.  
  327. local function smartAim(rim)
  328. local offset = computeOffset()
  329. local root = plr.Character and plr.Character:FindFirstChild('HumanoidRootPart')
  330. if not root then return rim.Position end
  331. local dist = (root.Position - rim.Position).Magnitude
  332. return rim.Position + computeArc(dist) - offset
  333. end
  334.  
  335. local function fireShootRemote(aimPos, shootFrom)
  336. if not shootRemote then return end
  337. if shootRemote.Name:lower():find('shoot') and shootRemote.Parent and shootRemote.Parent:IsDescendantOf(Workspace) then
  338. local char = plr.Character
  339. local root = char and char.PrimaryPart
  340. local head = char and char:FindFirstChild('Head')
  341. if not (char and root and head) then return end
  342. local dir = (aimPos - head.Position).Unit
  343. local stateTable = {
  344. CFrame = root.CFrame,
  345. FieldOfView = Camera.FieldOfView,
  346. ViewportSize = Camera.ViewportSize,
  347. }
  348. local tool = ballTool or (char and char:FindFirstChildOfClass('Tool'))
  349. shootRemote:FireServer(
  350. aimPos,
  351. shootFrom or (root.Position + dir * 4),
  352. shootKey,
  353. tool,
  354. CURRENT_POWER, -- dynamic power
  355. stateTable,
  356. true
  357. )
  358. else
  359. shootRemote:FireServer(aimPos, shootFrom, shootKey)
  360. end
  361. end
  362.  
  363. local function shootAtTarget()
  364. if not getgenv().PAYLOAD0_SYSTEM_ACTIVE then return end
  365. if not (selectedRim and selectedRim:IsDescendantOf(Workspace)) then return end
  366. if not shootKey then return end
  367. if not shootRemote then return end
  368. local char = plr.Character
  369. if not char then return end
  370. local head, root = char:FindFirstChild('Head'), char.PrimaryPart
  371. if not (head and root) then return end
  372. local aimPos = smartAim(selectedRim)
  373. local dir = (aimPos - head.Position).Unit
  374. local shootFrom = root.Position + dir * 3.8
  375. if shootFrom.Y - root.Position.Y < 4 then
  376. shootFrom = root.Position + dir * 4
  377. end
  378. fireShootRemote(aimPos, shootFrom)
  379. end
  380.  
  381. UserInputService.InputBegan:Connect(function(i, gp)
  382. if gp or not getgenv().PAYLOAD0_SYSTEM_ACTIVE then return end
  383. if i.UserInputType == Enum.UserInputType.MouseButton1 and hasBall() then
  384. shootAtTarget()
  385. end
  386. end)
  387.  
  388. -- === VISUALS & PUSH ===
  389. local hl = CoreGui:FindFirstChild('PerfectRangeGlow') or Instance.new('Highlight')
  390. hl.Name = 'PerfectRangeGlow'
  391. hl.DepthMode = Enum.HighlightDepthMode.AlwaysOnTop
  392. hl.FillTransparency = 0.25
  393. hl.OutlineTransparency = 0
  394. hl.Adornee = plr.Character
  395. hl.Parent = CoreGui
  396. hl.Enabled = false
  397.  
  398. local moveKeys = { W=false, A=false, S=false, D=false }
  399. UserInputService.InputBegan:Connect(function(i,gp) if gp then return end local k=i.KeyCode.Name if moveKeys[k]~=nil then moveKeys[k]=true end end)
  400. UserInputService.InputEnded:Connect(function(i,gp) if gp then return end local k=i.KeyCode.Name if moveKeys[k]~=nil then moveKeys[k]=false end end)
  401.  
  402. local function shouldPush()
  403. local c=0 for _,v in pairs(moveKeys) do if v then c+=1 end end
  404. return c==1 and (moveKeys.A or moveKeys.D)
  405. end
  406.  
  407. local smoothBias = Vector3.zero
  408. RunService.RenderStepped:Connect(function()
  409. if not getgenv().PAYLOAD0_SYSTEM_ACTIVE then hl.Enabled=false return end
  410. local char=plr.Character
  411. local hum=char and char:FindFirstChildOfClass('Humanoid')
  412. local root=char and char:FindFirstChild('HumanoidRootPart')
  413. if not (hum and root) then return end
  414. if not hasBall() then hl.Enabled=false return end
  415.  
  416. -- choose rim by static size set
  417. local rim,dist=nearestRim(root.Position)
  418. if not rim or dist>ACTIVE_RANGE_MAIN then hl.Enabled=false smoothBias=Vector3.zero return end
  419. selectedRim=rim
  420.  
  421. local target=getNearestPerfectDistance(dist)
  422. local diff=dist-target
  423. local absDiff=math.abs(diff)
  424.  
  425. -- Strength profile:
  426. -- - Inside CLAMP_RADIUS: strong push (linear up to 1.0)
  427. -- - Between CLAMP_RADIUS and SOFT_RADIUS: gentle pull-in (falls off to 0)
  428. -- - Outside SOFT_RADIUS: no push
  429. local strength
  430. if absDiff <= CLAMP_RADIUS then
  431. strength = (CLAMP_RADIUS - absDiff) / CLAMP_RADIUS -- 0..1
  432. elseif absDiff <= SOFT_RADIUS then
  433. strength = (SOFT_RADIUS - absDiff) / SOFT_RADIUS * 0.35 -- gentle, max ~0.35
  434. else
  435. strength = 0
  436. end
  437. strength = math.clamp(strength, 0, 1)
  438.  
  439. local desired = Vector3.zero
  440. if shouldPush() and strength > 0 then
  441. local toRim=Vector3.new(rim.Position.X,0,rim.Position.Z)-Vector3.new(root.Position.X,0,root.Position.Z)
  442. local distSign=math.sign(diff)
  443. if distSign>0 then
  444. local pushDir=-toRim.Unit
  445. desired=pushDir*math.min(strength*MAX_PUSH,MAX_PUSH)
  446. end
  447. end
  448.  
  449. smoothBias=smoothBias*DAMPING+desired*(1-DAMPING)
  450. root.CFrame+=Vector3.new(smoothBias.X,0,smoothBias.Z)
  451.  
  452. if VisualsEnabled then
  453. hl.Enabled=true
  454. if absDiff<=0.10 then
  455. hl.FillColor,hl.OutlineColor=COLOR_GREEN,COLOR_GREEN
  456. elseif absDiff<SOFT_RADIUS then
  457. hl.FillColor,hl.OutlineColor=COLOR_GREEN_SOFT,COLOR_GREEN_SOFT
  458. else
  459. hl.Enabled=false
  460. end
  461. else
  462. hl.Enabled=false
  463. end
  464. end)
  465.  
  466. plr.CharacterAdded:Connect(function(c)
  467. task.wait(0.5)
  468. hl.Adornee=c
  469. end)
  470.  
  471. print('[🏀 PAYLOAD0 LOADED — STATIC RimSize + AUTO POWER + SOFT PUSH]')
  472. print('[V] Toggle system | [O] Toggle visuals | [LMB] Shoot')
  473.  
Advertisement
Add Comment
Please, Sign In to add comment