ColdSpecs

Not adjusting properly but is persistent (LBU)

Nov 2nd, 2025
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.32 KB | None | 0 0
  1. --// ======================================================================
  2. --// PAYLOAD0 • AUTO-AIM + ALIGN-ASSIST (SMART REMOTE + RIM-LOCK)
  3. --// • Works with legacy ReplicatedStorage Remotes.Shoot and new Workspace shoot_event
  4. --// • Auto-locks nearest visible rim; pushback assist only when holding ball
  5. --// • Green visuals when in (near) perfect range
  6. --// • Calibrate UI only when needed; captures shoot key once
  7. --// • Smart remote listener re-hooks when the remote is replaced
  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. -- === STATE ===
  24. getgenv().PAYLOAD0_SYSTEM_ACTIVE = true
  25. local VisualsEnabled = true
  26. local shootKey : string? = nil
  27. local selectedRim : BasePart? = nil
  28. local activeNotifyGui
  29. local ballTool : Tool? = nil
  30.  
  31. -- === CONFIGURATION ===
  32. local PERFECT_DISTANCES = { 54.97, 61.53, 68.10 }
  33. local CLAMP_RADIUS = 1
  34. local ACTIVE_RANGE_MAIN = 90
  35. local MAX_PUSH = 0.06
  36. local DAMPING = 0.9
  37. local SHOOT_POWER = 30 -- used for new Workspace shoot_event
  38.  
  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 (ONLY WHEN HOLDING BALL + NO KEY) ===
  86. local calibrateGui
  87. local function showCalibrateUI()
  88. if calibrateGui or shootKey or not hasBall() then return end
  89.  
  90. calibrateGui = Instance.new('ScreenGui')
  91. calibrateGui.Name = 'CalibrateReminder'
  92. calibrateGui.ResetOnSpawn = false
  93. calibrateGui.IgnoreGuiInset = true
  94. calibrateGui.Parent = CoreGui
  95.  
  96. local frame = Instance.new('Frame')
  97. frame.AnchorPoint = Vector2.new(0.5, 0.5)
  98. frame.Position = UDim2.new(0.5, 0, 0.85, 0)
  99. frame.Size = UDim2.new(0, 420, 0, 45)
  100. frame.BackgroundTransparency = 0.3
  101. frame.BackgroundColor3 = Color3.fromRGB(20, 20, 20)
  102. frame.BorderSizePixel = 0
  103. frame.Parent = calibrateGui
  104.  
  105. local stroke = Instance.new('UIStroke')
  106. stroke.Color = Color3.fromRGB(80, 255, 120)
  107. stroke.Thickness = 1.6
  108. stroke.Parent = frame
  109.  
  110. local corner = Instance.new('UICorner')
  111. corner.CornerRadius = UDim.new(0, 10)
  112. corner.Parent = frame
  113.  
  114. local label = Instance.new('TextLabel')
  115. label.BackgroundTransparency = 1
  116. label.Size = UDim2.new(1, 0, 1, 0)
  117. label.Font = Enum.Font.GothamMedium
  118. label.TextSize = 22
  119. label.TextColor3 = Color3.fromRGB(120, 255, 150)
  120. label.Text = '🏀 Click once to calibrate your shot.'
  121. label.Parent = frame
  122.  
  123. task.spawn(function()
  124. while calibrateGui and not shootKey and hasBall() do
  125. local t1 = TweenService:Create(label, TweenInfo.new(0.8, Enum.EasingStyle.Sine), {TextTransparency = 0.3})
  126. local t2 = TweenService:Create(label, TweenInfo.new(0.8, Enum.EasingStyle.Sine), {TextTransparency = 0})
  127. t1:Play(); t1.Completed:Wait()
  128. t2:Play(); t2.Completed:Wait()
  129. end
  130. end)
  131. end
  132.  
  133. local function removeCalibrateUI()
  134. if calibrateGui then calibrateGui:Destroy(); calibrateGui = nil end
  135. end
  136.  
  137. task.spawn(function()
  138. while task.wait(0.5) do
  139. if not hasBall() or shootKey then removeCalibrateUI() else showCalibrateUI() end
  140. end
  141. end)
  142.  
  143. --// =============================================================
  144. --// SMART REMOTE LISTENER – handles both legacy & new remotes
  145. --// =============================================================
  146. local shootRemote : RemoteEvent? = nil
  147. local hookedMeta = nil
  148. local SEARCH_PATTERN = 'shoot'
  149.  
  150. -- refresh possible roots (some games respawn containers)
  151. local function getRoots()
  152. local roots = {}
  153.  
  154. -- New pattern: Workspace.isokcocs.Basketball (per-user container)
  155. local userFolder = Workspace:FindFirstChild(plr.Name)
  156. if userFolder and userFolder:FindFirstChild('Basketball') then
  157. table.insert(roots, userFolder.Basketball)
  158. end
  159.  
  160. -- Fallback to a static folder named 'isokcocs' if it exists
  161. local iso = Workspace:FindFirstChild('isokcocs')
  162. if iso and iso:FindFirstChild('Basketball') then
  163. table.insert(roots, iso.Basketball)
  164. end
  165.  
  166. -- Legacy: ReplicatedStorage.Remotes.Shoot
  167. local remotes = ReplicatedStorage:FindFirstChild('Remotes')
  168. if remotes then table.insert(roots, remotes) end
  169.  
  170. return roots
  171. end
  172.  
  173. local function findShootRemote()
  174. for _, root in ipairs(getRoots()) do
  175. for _, obj in ipairs(root:GetDescendants()) do
  176. if obj:IsA('RemoteEvent') and obj.Name:lower():find(SEARCH_PATTERN) then
  177. return obj
  178. end
  179. end
  180. -- also check direct children for legacy Shoot
  181. local direct = root:FindFirstChild('Shoot')
  182. if direct and direct:IsA('RemoteEvent') then
  183. return direct
  184. end
  185. end
  186. return nil
  187. end
  188.  
  189. local function hookRemote(remote : RemoteEvent)
  190. if hookedMeta then return end
  191. local old
  192. old = hookmetamethod(game, '__namecall', function(self, ...)
  193. local m = getnamecallmethod()
  194. if m == 'FireServer' and self == remote then
  195. local args = {...}
  196. if type(args[3]) == 'string' and not shootKey then
  197. shootKey = args[3]
  198. removeCalibrateUI()
  199. pcall(function() notify('Shoot key captured: '..shootKey, COLOR_GREEN) end)
  200. end
  201. end
  202. return old(self, ...)
  203. end)
  204. hookedMeta = old
  205. shootRemote = remote
  206. pcall(function() notify('Remote locked: '..remote:GetFullName(), COLOR_GREEN) end)
  207. end
  208.  
  209. local function unhookRemote()
  210. hookedMeta = nil
  211. shootRemote = nil
  212. end
  213.  
  214. RunService.Heartbeat:Connect(function()
  215. if not getgenv().PAYLOAD0_SYSTEM_ACTIVE then return end
  216. local current = findShootRemote()
  217. if current then
  218. if current ~= shootRemote then
  219. unhookRemote()
  220. hookRemote(current)
  221. end
  222. elseif shootRemote then
  223. unhookRemote()
  224. end
  225. end)
  226.  
  227. -- === RIM TRACKING ===
  228. local RimSize = Vector3.new(3.632131576538086, 0.5587897300720215, 3.632131576538086)
  229. local Rims = {}
  230. Workspace.DescendantAdded:Connect(function(o)
  231. if o:IsA('BasePart') and o.Name == 'Rim' and o.Size == RimSize then
  232. table.insert(Rims, o)
  233. end
  234. end)
  235. for _, v in ipairs(Workspace:GetDescendants()) do
  236. if v:IsA('BasePart') and v.Name == 'Rim' and v.Size == RimSize then
  237. table.insert(Rims, v)
  238. end
  239. end
  240. Workspace.DescendantRemoving:Connect(function(o)
  241. for i, rim in ipairs(Rims) do
  242. if rim == o then table.remove(Rims, i); break end
  243. end
  244. if selectedRim == o then selectedRim = nil end
  245. end)
  246.  
  247. -- === AUTO RIM LOCK ===
  248. task.spawn(function()
  249. while task.wait(0.1) do
  250. if not getgenv().PAYLOAD0_SYSTEM_ACTIVE then continue end
  251. local root = plr.Character and plr.Character:FindFirstChild('HumanoidRootPart')
  252. if not root then continue end
  253.  
  254. local bestRim, bestDist = nil, 85
  255. for _, rim in ipairs(Rims) do
  256. if rim:IsDescendantOf(Workspace) then
  257. local dist = (rim.Position - root.Position).Magnitude
  258. if dist < bestDist then
  259. local _, on = Camera:WorldToViewportPoint(rim.Position)
  260. if on then bestRim, bestDist = rim, dist end
  261. end
  262. end
  263. end
  264. if bestRim and bestRim ~= selectedRim then
  265. selectedRim = bestRim
  266. end
  267. end
  268. end)
  269.  
  270. -- === TOGGLES ===
  271. UserInputService.InputBegan:Connect(function(i, gp)
  272. if gp then return end
  273. if i.KeyCode == Enum.KeyCode.O then
  274. VisualsEnabled = not VisualsEnabled
  275. notify(VisualsEnabled and '👁 Visuals ON' or '🙈 Visuals OFF',
  276. VisualsEnabled and COLOR_GREEN or Color3.fromRGB(255,80,80))
  277. elseif i.KeyCode == Enum.KeyCode.V then
  278. getgenv().PAYLOAD0_SYSTEM_ACTIVE = not getgenv().PAYLOAD0_SYSTEM_ACTIVE
  279. notify(getgenv().PAYLOAD0_SYSTEM_ACTIVE and '✅ System ON' or '🚫 System OFF',
  280. getgenv().PAYLOAD0_SYSTEM_ACTIVE and COLOR_GREEN or Color3.fromRGB(255,80,80))
  281. end
  282. end)
  283.  
  284. -- === SHOOT LOGIC HELPERS ===
  285. local lastTick, moveOffset = 0, Vector3.zero
  286. local function computeOffset()
  287. if tick() - lastTick > 0.1 then
  288. local hum = plr.Character and plr.Character:FindFirstChildOfClass('Humanoid')
  289. local moveDir = (hum and hum.MoveDirection) or Vector3.zero
  290. moveOffset = Vector3.new(moveDir.X * 1.5, 0, moveDir.Z * 1.5)
  291. lastTick = tick()
  292. end
  293. return moveOffset
  294. end
  295.  
  296. local function computeArc(dist) return Vector3.new(0, 43 + (dist / 15), 0) end
  297.  
  298. local function smartAim(rim)
  299. local offset = computeOffset()
  300. local root = plr.Character and plr.Character:FindFirstChild('HumanoidRootPart')
  301. if not root then return rim.Position end
  302. local dist = (root.Position - rim.Position).Magnitude
  303. return rim.Position + computeArc(dist) - offset
  304. end
  305.  
  306. -- Fire helper that adapts to remote flavor
  307. local function fireShootRemote(aimPos, shootFrom)
  308. if not shootRemote then return end
  309. -- New event usually named "shoot_event" in Workspace with richer payload
  310. if shootRemote.Name:lower():find('shoot') and shootRemote.Parent and shootRemote.Parent:IsDescendantOf(Workspace) then
  311. local char = plr.Character
  312. local root = char and char.PrimaryPart
  313. local head = char and char:FindFirstChild('Head')
  314. if not (char and root and head) then return end
  315. local dir = (aimPos - head.Position).Unit
  316.  
  317. -- camera / state table (loose; server typically validates leniently)
  318. local stateTable = {
  319. CFrame = root.CFrame,
  320. FieldOfView = Camera.FieldOfView,
  321. ViewportSize = Camera.ViewportSize,
  322. }
  323.  
  324. -- prefer the equipped tool for arg4
  325. local tool = ballTool or (char and char:FindFirstChildOfClass('Tool'))
  326.  
  327. shootRemote:FireServer(
  328. aimPos, -- 1 target
  329. shootFrom or (root.Position + dir * 4), -- 2 origin
  330. shootKey, -- 3 key captured via hook
  331. tool, -- 4 ball tool (if required)
  332. SHOOT_POWER, -- 5 power
  333. stateTable, -- 6 state
  334. true -- 7 confirm
  335. )
  336. else
  337. -- Legacy ReplicatedStorage.Remotes.Shoot(aimPos, from, key)
  338. shootRemote:FireServer(aimPos, shootFrom, shootKey)
  339. end
  340. end
  341.  
  342. local function shootAtTarget()
  343. if not getgenv().PAYLOAD0_SYSTEM_ACTIVE then return end
  344. if not (selectedRim and selectedRim:IsDescendantOf(Workspace)) then return end
  345. if not shootKey then return end
  346. if not shootRemote then return end
  347.  
  348. local char = plr.Character
  349. if not char then return end
  350. local head, root = char:FindFirstChild('Head'), char.PrimaryPart
  351. if not (head and root) then return end
  352.  
  353. local aimPos = smartAim(selectedRim)
  354. local dir = (aimPos - head.Position).Unit
  355. local shootFrom = root.Position + dir * 3.8
  356. if shootFrom.Y - root.Position.Y < 4 then
  357. shootFrom = root.Position + dir * 4
  358. end
  359. fireShootRemote(aimPos, shootFrom)
  360. end
  361.  
  362. UserInputService.InputBegan:Connect(function(i, gp)
  363. if gp or not getgenv().PAYLOAD0_SYSTEM_ACTIVE then return end
  364. if i.UserInputType == Enum.UserInputType.MouseButton1 and hasBall() then
  365. shootAtTarget()
  366. end
  367. end)
  368.  
  369. -- === HIGHLIGHT VISUAL ===
  370. local hl = CoreGui:FindFirstChild('PerfectRangeGlow') or Instance.new('Highlight')
  371. hl.Name = 'PerfectRangeGlow'
  372. hl.DepthMode = Enum.HighlightDepthMode.AlwaysOnTop
  373. hl.FillTransparency = 0.25
  374. hl.OutlineTransparency = 0
  375. hl.Adornee = plr.Character
  376. hl.Parent = CoreGui
  377. hl.Enabled = false
  378.  
  379. -- === MOVEMENT KEYS FOR PUSH ===
  380. local moveKeys = { W = false, A = false, S = false, D = false }
  381. UserInputService.InputBegan:Connect(function(i, gp)
  382. if gp then return end
  383. local k = i.KeyCode.Name
  384. if moveKeys[k] ~= nil then moveKeys[k] = true end
  385. end)
  386. UserInputService.InputEnded:Connect(function(i, gp)
  387. if gp then return end
  388. local k = i.KeyCode.Name
  389. if moveKeys[k] ~= nil then moveKeys[k] = false end
  390. end)
  391.  
  392. local function shouldPush()
  393. local count = 0
  394. for _, v in pairs(moveKeys) do if v then count += 1 end end
  395. return count == 1 and (moveKeys.A or moveKeys.D)
  396. end
  397.  
  398. -- === PUSH LOGIC (Lol parts inside Rim) ===
  399. local rimsForPush = {}
  400. for _, v in ipairs(Workspace:GetDescendants()) do
  401. if v:IsA('BasePart') and v.Name == 'Lol' and v.Parent and v.Parent.Name == 'Rim' then
  402. table.insert(rimsForPush, v)
  403. end
  404. end
  405.  
  406. local function nearestRim(rootPos)
  407. local nearest, nearestDist
  408. for _, rim in ipairs(rimsForPush) do
  409. if rim:IsDescendantOf(Workspace) then
  410. local rimXZ = Vector3.new(rim.Position.X, 0, rim.Position.Z)
  411. local dist = (rimXZ - Vector3.new(rootPos.X, 0, rootPos.Z)).Magnitude
  412. if not nearestDist or dist < nearestDist then
  413. nearest, nearestDist = rim, dist
  414. end
  415. end
  416. end
  417. return nearest, nearestDist
  418. end
  419.  
  420. local function getNearestPerfectDistance(current)
  421. local nearest, smallestDiff
  422. for _, pd in ipairs(PERFECT_DISTANCES) do
  423. local diff = math.abs(pd - current)
  424. if not smallestDiff or diff < smallestDiff then
  425. nearest, smallestDiff = pd, diff
  426. end
  427. end
  428. return nearest
  429. end
  430.  
  431. -- === RUNTIME LOOP ===
  432. local smoothBias = Vector3.zero
  433. RunService.RenderStepped:Connect(function()
  434. if not getgenv().PAYLOAD0_SYSTEM_ACTIVE then
  435. hl.Enabled = false
  436. return
  437. end
  438.  
  439. local char = plr.Character
  440. local hum = char and char:FindFirstChildOfClass('Humanoid')
  441. local root = char and char:FindFirstChild('HumanoidRootPart')
  442. if not (hum and root) then return end
  443.  
  444. if not hasBall() then
  445. hl.Enabled = false
  446. return
  447. end
  448.  
  449. local rim, dist = nearestRim(root.Position)
  450. if not rim or dist > ACTIVE_RANGE_MAIN then
  451. hl.Enabled = false
  452. smoothBias = Vector3.zero
  453. return
  454. end
  455.  
  456. local target = getNearestPerfectDistance(dist)
  457. local diff = dist - target
  458. local absDiff = math.abs(diff)
  459. local desired = Vector3.zero
  460.  
  461. if shouldPush() and absDiff < CLAMP_RADIUS then
  462. local strength = (CLAMP_RADIUS - absDiff) / CLAMP_RADIUS
  463. local toRim = Vector3.new(rim.Position.X, 0, rim.Position.Z) - Vector3.new(root.Position.X, 0, root.Position.Z)
  464. local distSign = math.sign(diff)
  465. if distSign > 0 then
  466. local pushDir = -toRim.Unit
  467. desired = pushDir * math.min(strength * MAX_PUSH, MAX_PUSH)
  468. end
  469. end
  470.  
  471. smoothBias = smoothBias * DAMPING + desired * (1 - DAMPING)
  472. root.CFrame += Vector3.new(smoothBias.X, 0, smoothBias.Z)
  473.  
  474. -- Visuals
  475. if VisualsEnabled then
  476. hl.Enabled = true
  477. if absDiff <= 0.10 then
  478. hl.FillColor, hl.OutlineColor = COLOR_GREEN, COLOR_GREEN
  479. elseif absDiff < CLAMP_RADIUS then
  480. hl.FillColor, hl.OutlineColor = COLOR_GREEN_SOFT, COLOR_GREEN_SOFT
  481. else
  482. hl.Enabled = false
  483. end
  484. else
  485. hl.Enabled = false
  486. end
  487. end)
  488.  
  489. -- Re-attach highlight on respawn
  490. plr.CharacterAdded:Connect(function(c)
  491. task.wait(0.5)
  492. hl.Adornee = c
  493. end)
  494.  
Advertisement
Add Comment
Please, Sign In to add comment