Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --// ======================================================================
- --// PAYLOAD0 • AUTO-AIM + ALIGN-ASSIST (SMART REMOTE + RIM-LOCK)
- --// • Works with legacy ReplicatedStorage Remotes.Shoot and new Workspace shoot_event
- --// • Auto-locks nearest visible rim; pushback assist only when holding ball
- --// • Green visuals when in (near) perfect range
- --// • Calibrate UI only when needed; captures shoot key once
- --// • Smart remote listener re-hooks when the remote is replaced
- --// ======================================================================
- -- === SERVICES ===
- local Players = game:GetService('Players')
- local UserInputService = game:GetService('UserInputService')
- local RunService = game:GetService('RunService')
- local ReplicatedStorage = game:GetService('ReplicatedStorage')
- local CoreGui = game:GetService('CoreGui')
- local TweenService = game:GetService('TweenService')
- local Workspace = game:GetService('Workspace')
- local Camera = workspace.CurrentCamera
- local plr = Players.LocalPlayer
- local char = plr.Character or plr.CharacterAdded:Wait()
- -- === STATE ===
- getgenv().PAYLOAD0_SYSTEM_ACTIVE = true
- local VisualsEnabled = true
- local shootKey : string? = nil
- local selectedRim : BasePart? = nil
- local activeNotifyGui
- local ballTool : Tool? = nil
- -- === CONFIGURATION ===
- local PERFECT_DISTANCES = { 54.97, 61.53, 68.10 }
- local CLAMP_RADIUS = 1
- local ACTIVE_RANGE_MAIN = 90
- local MAX_PUSH = 0.06
- local DAMPING = 0.9
- local SHOOT_POWER = 30 -- used for new Workspace shoot_event
- local COLOR_GREEN = Color3.fromRGB(0, 255, 100)
- local COLOR_GREEN_SOFT = Color3.fromRGB(0, 200, 80)
- -- === NOTIFY SYSTEM ===
- local function notify(msg, color)
- if activeNotifyGui and activeNotifyGui.Parent then
- activeNotifyGui:Destroy()
- end
- local gui = Instance.new('ScreenGui')
- gui.ResetOnSpawn = false
- gui.Parent = CoreGui
- activeNotifyGui = gui
- local label = Instance.new('TextLabel')
- label.AnchorPoint = Vector2.new(0.5, 0.5)
- label.BackgroundTransparency = 1
- label.TextColor3 = color or Color3.fromRGB(255, 255, 255)
- label.Font = Enum.Font.Code
- label.TextSize = 26
- label.Text = msg
- label.Position = UDim2.new(0.5, 0, 0.9, 0)
- label.Parent = gui
- task.spawn(function()
- task.wait(1.2)
- if gui == activeNotifyGui then
- gui:Destroy()
- activeNotifyGui = nil
- end
- end)
- end
- -- === HELPER: BALL CHECK ===
- local function hasBall()
- local c = plr.Character
- if not c then return false end
- for _, tool in ipairs(c:GetChildren()) do
- if tool:IsA('Tool') and tool.Name:lower():find('ball') then
- ballTool = tool
- return true
- end
- end
- ballTool = nil
- return false
- end
- -- === CALIBRATE UI (ONLY WHEN HOLDING BALL + NO KEY) ===
- local calibrateGui
- local function showCalibrateUI()
- if calibrateGui or shootKey or not hasBall() then return end
- calibrateGui = Instance.new('ScreenGui')
- calibrateGui.Name = 'CalibrateReminder'
- calibrateGui.ResetOnSpawn = false
- calibrateGui.IgnoreGuiInset = true
- calibrateGui.Parent = CoreGui
- local frame = Instance.new('Frame')
- frame.AnchorPoint = Vector2.new(0.5, 0.5)
- frame.Position = UDim2.new(0.5, 0, 0.85, 0)
- frame.Size = UDim2.new(0, 420, 0, 45)
- frame.BackgroundTransparency = 0.3
- frame.BackgroundColor3 = Color3.fromRGB(20, 20, 20)
- frame.BorderSizePixel = 0
- frame.Parent = calibrateGui
- local stroke = Instance.new('UIStroke')
- stroke.Color = Color3.fromRGB(80, 255, 120)
- stroke.Thickness = 1.6
- stroke.Parent = frame
- local corner = Instance.new('UICorner')
- corner.CornerRadius = UDim.new(0, 10)
- corner.Parent = frame
- local label = Instance.new('TextLabel')
- label.BackgroundTransparency = 1
- label.Size = UDim2.new(1, 0, 1, 0)
- label.Font = Enum.Font.GothamMedium
- label.TextSize = 22
- label.TextColor3 = Color3.fromRGB(120, 255, 150)
- label.Text = '🏀 Click once to calibrate your shot.'
- label.Parent = frame
- task.spawn(function()
- while calibrateGui and not shootKey and hasBall() do
- local t1 = TweenService:Create(label, TweenInfo.new(0.8, Enum.EasingStyle.Sine), {TextTransparency = 0.3})
- local t2 = TweenService:Create(label, TweenInfo.new(0.8, Enum.EasingStyle.Sine), {TextTransparency = 0})
- t1:Play(); t1.Completed:Wait()
- t2:Play(); t2.Completed:Wait()
- end
- end)
- end
- local function removeCalibrateUI()
- if calibrateGui then calibrateGui:Destroy(); calibrateGui = nil end
- end
- task.spawn(function()
- while task.wait(0.5) do
- if not hasBall() or shootKey then removeCalibrateUI() else showCalibrateUI() end
- end
- end)
- --// =============================================================
- --// SMART REMOTE LISTENER – handles both legacy & new remotes
- --// =============================================================
- local shootRemote : RemoteEvent? = nil
- local hookedMeta = nil
- local SEARCH_PATTERN = 'shoot'
- -- refresh possible roots (some games respawn containers)
- local function getRoots()
- local roots = {}
- -- New pattern: Workspace.isokcocs.Basketball (per-user container)
- local userFolder = Workspace:FindFirstChild(plr.Name)
- if userFolder and userFolder:FindFirstChild('Basketball') then
- table.insert(roots, userFolder.Basketball)
- end
- -- Fallback to a static folder named 'isokcocs' if it exists
- local iso = Workspace:FindFirstChild('isokcocs')
- if iso and iso:FindFirstChild('Basketball') then
- table.insert(roots, iso.Basketball)
- end
- -- Legacy: ReplicatedStorage.Remotes.Shoot
- local remotes = ReplicatedStorage:FindFirstChild('Remotes')
- if remotes then table.insert(roots, remotes) end
- return roots
- end
- local function findShootRemote()
- for _, root in ipairs(getRoots()) do
- for _, obj in ipairs(root:GetDescendants()) do
- if obj:IsA('RemoteEvent') and obj.Name:lower():find(SEARCH_PATTERN) then
- return obj
- end
- end
- -- also check direct children for legacy Shoot
- local direct = root:FindFirstChild('Shoot')
- if direct and direct:IsA('RemoteEvent') then
- return direct
- end
- end
- return nil
- end
- local function hookRemote(remote : RemoteEvent)
- if hookedMeta then return end
- local old
- old = hookmetamethod(game, '__namecall', function(self, ...)
- local m = getnamecallmethod()
- if m == 'FireServer' and self == remote then
- local args = {...}
- if type(args[3]) == 'string' and not shootKey then
- shootKey = args[3]
- removeCalibrateUI()
- pcall(function() notify('Shoot key captured: '..shootKey, COLOR_GREEN) end)
- end
- end
- return old(self, ...)
- end)
- hookedMeta = old
- shootRemote = remote
- pcall(function() notify('Remote locked: '..remote:GetFullName(), COLOR_GREEN) end)
- end
- local function unhookRemote()
- hookedMeta = nil
- shootRemote = nil
- end
- RunService.Heartbeat:Connect(function()
- if not getgenv().PAYLOAD0_SYSTEM_ACTIVE then return end
- local current = findShootRemote()
- if current then
- if current ~= shootRemote then
- unhookRemote()
- hookRemote(current)
- end
- elseif shootRemote then
- unhookRemote()
- end
- end)
- -- === RIM TRACKING ===
- local RimSize = Vector3.new(3.632131576538086, 0.5587897300720215, 3.632131576538086)
- local Rims = {}
- Workspace.DescendantAdded:Connect(function(o)
- if o:IsA('BasePart') and o.Name == 'Rim' and o.Size == RimSize then
- table.insert(Rims, o)
- end
- end)
- for _, v in ipairs(Workspace:GetDescendants()) do
- if v:IsA('BasePart') and v.Name == 'Rim' and v.Size == RimSize then
- table.insert(Rims, v)
- end
- end
- Workspace.DescendantRemoving:Connect(function(o)
- for i, rim in ipairs(Rims) do
- if rim == o then table.remove(Rims, i); break end
- end
- if selectedRim == o then selectedRim = nil end
- end)
- -- === AUTO RIM LOCK ===
- task.spawn(function()
- while task.wait(0.1) do
- if not getgenv().PAYLOAD0_SYSTEM_ACTIVE then continue end
- local root = plr.Character and plr.Character:FindFirstChild('HumanoidRootPart')
- if not root then continue end
- local bestRim, bestDist = nil, 85
- for _, rim in ipairs(Rims) do
- if rim:IsDescendantOf(Workspace) then
- local dist = (rim.Position - root.Position).Magnitude
- if dist < bestDist then
- local _, on = Camera:WorldToViewportPoint(rim.Position)
- if on then bestRim, bestDist = rim, dist end
- end
- end
- end
- if bestRim and bestRim ~= selectedRim then
- selectedRim = bestRim
- end
- end
- end)
- -- === TOGGLES ===
- UserInputService.InputBegan:Connect(function(i, gp)
- if gp then return end
- if i.KeyCode == Enum.KeyCode.O then
- VisualsEnabled = not VisualsEnabled
- notify(VisualsEnabled and '👁 Visuals ON' or '🙈 Visuals OFF',
- VisualsEnabled and COLOR_GREEN or Color3.fromRGB(255,80,80))
- elseif i.KeyCode == Enum.KeyCode.V then
- getgenv().PAYLOAD0_SYSTEM_ACTIVE = not getgenv().PAYLOAD0_SYSTEM_ACTIVE
- notify(getgenv().PAYLOAD0_SYSTEM_ACTIVE and '✅ System ON' or '🚫 System OFF',
- getgenv().PAYLOAD0_SYSTEM_ACTIVE and COLOR_GREEN or Color3.fromRGB(255,80,80))
- end
- end)
- -- === SHOOT LOGIC HELPERS ===
- local lastTick, moveOffset = 0, Vector3.zero
- local function computeOffset()
- if tick() - lastTick > 0.1 then
- local hum = plr.Character and plr.Character:FindFirstChildOfClass('Humanoid')
- local moveDir = (hum and hum.MoveDirection) or Vector3.zero
- moveOffset = Vector3.new(moveDir.X * 1.5, 0, moveDir.Z * 1.5)
- lastTick = tick()
- end
- return moveOffset
- end
- local function computeArc(dist) return Vector3.new(0, 43 + (dist / 15), 0) end
- local function smartAim(rim)
- local offset = computeOffset()
- local root = plr.Character and plr.Character:FindFirstChild('HumanoidRootPart')
- if not root then return rim.Position end
- local dist = (root.Position - rim.Position).Magnitude
- return rim.Position + computeArc(dist) - offset
- end
- -- Fire helper that adapts to remote flavor
- local function fireShootRemote(aimPos, shootFrom)
- if not shootRemote then return end
- -- New event usually named "shoot_event" in Workspace with richer payload
- if shootRemote.Name:lower():find('shoot') and shootRemote.Parent and shootRemote.Parent:IsDescendantOf(Workspace) then
- local char = plr.Character
- local root = char and char.PrimaryPart
- local head = char and char:FindFirstChild('Head')
- if not (char and root and head) then return end
- local dir = (aimPos - head.Position).Unit
- -- camera / state table (loose; server typically validates leniently)
- local stateTable = {
- CFrame = root.CFrame,
- FieldOfView = Camera.FieldOfView,
- ViewportSize = Camera.ViewportSize,
- }
- -- prefer the equipped tool for arg4
- local tool = ballTool or (char and char:FindFirstChildOfClass('Tool'))
- shootRemote:FireServer(
- aimPos, -- 1 target
- shootFrom or (root.Position + dir * 4), -- 2 origin
- shootKey, -- 3 key captured via hook
- tool, -- 4 ball tool (if required)
- SHOOT_POWER, -- 5 power
- stateTable, -- 6 state
- true -- 7 confirm
- )
- else
- -- Legacy ReplicatedStorage.Remotes.Shoot(aimPos, from, key)
- shootRemote:FireServer(aimPos, shootFrom, shootKey)
- end
- end
- local function shootAtTarget()
- if not getgenv().PAYLOAD0_SYSTEM_ACTIVE then return end
- if not (selectedRim and selectedRim:IsDescendantOf(Workspace)) then return end
- if not shootKey then return end
- if not shootRemote then return end
- local char = plr.Character
- if not char then return end
- local head, root = char:FindFirstChild('Head'), char.PrimaryPart
- if not (head and root) then return end
- local aimPos = smartAim(selectedRim)
- local dir = (aimPos - head.Position).Unit
- local shootFrom = root.Position + dir * 3.8
- if shootFrom.Y - root.Position.Y < 4 then
- shootFrom = root.Position + dir * 4
- end
- fireShootRemote(aimPos, shootFrom)
- end
- UserInputService.InputBegan:Connect(function(i, gp)
- if gp or not getgenv().PAYLOAD0_SYSTEM_ACTIVE then return end
- if i.UserInputType == Enum.UserInputType.MouseButton1 and hasBall() then
- shootAtTarget()
- end
- end)
- -- === HIGHLIGHT VISUAL ===
- local hl = CoreGui:FindFirstChild('PerfectRangeGlow') or Instance.new('Highlight')
- hl.Name = 'PerfectRangeGlow'
- hl.DepthMode = Enum.HighlightDepthMode.AlwaysOnTop
- hl.FillTransparency = 0.25
- hl.OutlineTransparency = 0
- hl.Adornee = plr.Character
- hl.Parent = CoreGui
- hl.Enabled = false
- -- === MOVEMENT KEYS FOR PUSH ===
- local moveKeys = { W = false, A = false, S = false, D = false }
- 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)
- 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)
- local function shouldPush()
- local count = 0
- for _, v in pairs(moveKeys) do if v then count += 1 end end
- return count == 1 and (moveKeys.A or moveKeys.D)
- end
- -- === PUSH LOGIC (Lol parts inside Rim) ===
- local rimsForPush = {}
- for _, v in ipairs(Workspace:GetDescendants()) do
- if v:IsA('BasePart') and v.Name == 'Lol' and v.Parent and v.Parent.Name == 'Rim' then
- table.insert(rimsForPush, v)
- end
- end
- local function nearestRim(rootPos)
- local nearest, nearestDist
- for _, rim in ipairs(rimsForPush) do
- if rim:IsDescendantOf(Workspace) then
- local rimXZ = Vector3.new(rim.Position.X, 0, rim.Position.Z)
- local dist = (rimXZ - Vector3.new(rootPos.X, 0, rootPos.Z)).Magnitude
- if not nearestDist or dist < nearestDist then
- nearest, nearestDist = rim, dist
- end
- end
- end
- return nearest, nearestDist
- end
- local function getNearestPerfectDistance(current)
- local nearest, smallestDiff
- for _, pd in ipairs(PERFECT_DISTANCES) do
- local diff = math.abs(pd - current)
- if not smallestDiff or diff < smallestDiff then
- nearest, smallestDiff = pd, diff
- end
- end
- return nearest
- end
- -- === RUNTIME LOOP ===
- local smoothBias = Vector3.zero
- RunService.RenderStepped:Connect(function()
- if not getgenv().PAYLOAD0_SYSTEM_ACTIVE then
- hl.Enabled = false
- return
- end
- local char = plr.Character
- local hum = char and char:FindFirstChildOfClass('Humanoid')
- local root = char and char:FindFirstChild('HumanoidRootPart')
- if not (hum and root) then return end
- if not hasBall() then
- hl.Enabled = false
- return
- end
- local rim, dist = nearestRim(root.Position)
- if not rim or dist > ACTIVE_RANGE_MAIN then
- hl.Enabled = false
- smoothBias = Vector3.zero
- return
- end
- local target = getNearestPerfectDistance(dist)
- local diff = dist - target
- local absDiff = math.abs(diff)
- local desired = Vector3.zero
- if shouldPush() and absDiff < CLAMP_RADIUS then
- local strength = (CLAMP_RADIUS - absDiff) / CLAMP_RADIUS
- local toRim = Vector3.new(rim.Position.X, 0, rim.Position.Z) - Vector3.new(root.Position.X, 0, root.Position.Z)
- local distSign = math.sign(diff)
- if distSign > 0 then
- local pushDir = -toRim.Unit
- desired = pushDir * math.min(strength * MAX_PUSH, MAX_PUSH)
- end
- end
- smoothBias = smoothBias * DAMPING + desired * (1 - DAMPING)
- root.CFrame += Vector3.new(smoothBias.X, 0, smoothBias.Z)
- -- Visuals
- if VisualsEnabled then
- hl.Enabled = true
- if absDiff <= 0.10 then
- hl.FillColor, hl.OutlineColor = COLOR_GREEN, COLOR_GREEN
- elseif absDiff < CLAMP_RADIUS then
- hl.FillColor, hl.OutlineColor = COLOR_GREEN_SOFT, COLOR_GREEN_SOFT
- else
- hl.Enabled = false
- end
- else
- hl.Enabled = false
- end
- end)
- -- Re-attach highlight on respawn
- plr.CharacterAdded:Connect(function(c)
- task.wait(0.5)
- hl.Adornee = c
- end)
Advertisement
Add Comment
Please, Sign In to add comment