-- [[ Rscripts Risk Notice ]] -- This script is not verified by rscripts.net. Deal with caution. -- -- Stay safe: -- • Never log in on unofficial Roblox sites or lookalike domains. -- • Real Roblox links use roblox.com (check the .com ending). -- • Treat fake Roblox login / "claim reward" pages as phishing. -- [[ End Rscripts Risk Notice ]] local CONFIG = { AutoFarm = false, TeleportMode = false, AutoSell = false, SellOnlyWhenFull = false, AutoUpgradeAll = false, BatchSize = 100, } local Players = game:GetService("Players") local Storage = game:GetService("ReplicatedStorage") local UserInputService = game:GetService("UserInputService") local player = Players.LocalPlayer local playerGui = player:WaitForChild("PlayerGui") local balls = workspace:WaitForChild("ActiveGolfBalls") local remotes = Storage:WaitForChild("RemotesNew") local sharedEnvironment = (getgenv and getgenv()) or _G local resumeSnapshot do local existingMarker = workspace:FindFirstChild("GolfYardBallStackMarker") if existingMarker then local clusters = {} local largestCluster for _, entity in ipairs(balls:GetChildren()) do local part if entity:IsA("BasePart") then part = entity elseif entity:IsA("Model") then part = entity.PrimaryPart or entity:FindFirstChildWhichIsA("BasePart", true) end if part then local position = part.Position local key = string.format( "%d:%d:%d", math.round(position.X * 4), math.round(position.Y * 4), math.round(position.Z * 4) ) local cluster = clusters[key] if not cluster then cluster = { entities = {}, cframe = entity:IsA("Model") and entity:GetPivot() or part.CFrame, } clusters[key] = cluster end cluster.entities[#cluster.entities + 1] = entity if not largestCluster or #cluster.entities > #largestCluster.entities then largestCluster = cluster end end end if largestCluster and #largestCluster.entities > 1 then resumeSnapshot = largestCluster end end end if type(sharedEnvironment.__GolfYardCleanup) == "function" then pcall(sharedEnvironment.__GolfYardCleanup, true) end local running = true local connections = {} local networker pcall(function() local modules = Storage:WaitForChild("Modules", 5) local packageRoot = modules and modules:WaitForChild("rwque", 5) local packages = packageRoot and packageRoot:WaitForChild("Packages", 5) local module = packages and packages:WaitForChild("Networker", 5) if module then networker = require(module).new() end end) local function fireServer(name, ...) if networker then networker:FireServer(name, ...) else remotes:WaitForChild(name):FireServer(...) end end local function safeFire(name, ...) local arguments = table.pack(...) return pcall(function() fireServer(name, table.unpack(arguments, 1, arguments.n)) end) end local function numericAttribute(name, fallback) local value = player:GetAttribute(name) return type(value) == "number" and value or fallback end local function bagIsFull() local count = player:GetAttribute("BagCount") local capacity = player:GetAttribute("BagCapacity") return type(count) == "number" and type(capacity) == "number" and count >= capacity end local function bagHasBalls() return numericAttribute("BagCount", 0) > 0 end local function getCharacterParts() local character = player.Character if not character then return nil, nil, nil end return character, character:FindFirstChild("HumanoidRootPart"), character:FindFirstChildWhichIsA("Humanoid") end local function collectBatch(origin) local radius = numericAttribute("CollectionRange", 60) local batch = {} for _, ball in ipairs(balls:GetChildren()) do if ball:IsA("BasePart") and (ball.Position - origin).Magnitude <= radius then table.insert(batch, ball) if #batch >= CONFIG.BatchSize then break end end end return batch end local targetList = {} local targetIndex = 0 local function refreshTargets() targetList = balls:GetChildren() targetIndex = 0 end local function nextTarget() for _ = 1, 2 do while targetIndex < #targetList do targetIndex += 1 local target = targetList[targetIndex] if target.Parent == balls and target:IsA("BasePart") then return target end end refreshTargets() end return nil end local selling = false local lastSellAt = -math.huge local sellStatus = "Ready" local function sellBag(waitForBagChange) if selling or os.clock() - lastSellAt < 0.25 then return false end selling = true sellStatus = "Selling" local startingCount = numericAttribute("BagCount", -1) local sold = false for _ = 1, 3 do local fired = safeFire("Fill") if fired and (not waitForBagChange or startingCount < 0) then sold = true break end if fired then local deadline = os.clock() + 0.8 repeat task.wait(0.08) local currentCount = numericAttribute("BagCount", startingCount) if currentCount < startingCount then sold = true break end until os.clock() >= deadline end if sold then break end task.wait(0.15) end lastSellAt = os.clock() sellStatus = sold and "Sold" or "Sell retry" selling = false return sold end local persistedStackState = sharedEnvironment.__GolfYardStackState if type(persistedStackState) ~= "table" then persistedStackState = { active = false, stackCFrame = nil, originals = {}, partStates = {}, visualStates = {}, } sharedEnvironment.__GolfYardStackState = persistedStackState end persistedStackState.originals = type(persistedStackState.originals) == "table" and persistedStackState.originals or {} persistedStackState.partStates = type(persistedStackState.partStates) == "table" and persistedStackState.partStates or {} persistedStackState.visualStates = type(persistedStackState.visualStates) == "table" and persistedStackState.visualStates or {} local ballStackActive = persistedStackState.active == true local ballStackCFrame = persistedStackState.stackCFrame local ballStackMarker local ballStackLabel local stackedEntities = persistedStackState.originals local hiddenParts = persistedStackState.partStates local hiddenVisuals = persistedStackState.visualStates local stackedCountCache = 0 local maintenanceEntities = {} local maintenanceIndex = 0 local function syncPersistedStackState() persistedStackState.active = ballStackActive persistedStackState.stackCFrame = ballStackCFrame persistedStackState.originals = stackedEntities persistedStackState.partStates = hiddenParts persistedStackState.visualStates = hiddenVisuals sharedEnvironment.__GolfYardStackState = persistedStackState end local function getEntityPart(entity) if entity:IsA("BasePart") then return entity end if entity:IsA("Model") then return entity.PrimaryPart or entity:FindFirstChildWhichIsA("BasePart", true) end return nil end local function rebuildStackCache() table.clear(maintenanceEntities) stackedCountCache = 0 maintenanceIndex = 0 for entity in pairs(stackedEntities) do if entity and entity.Parent == balls and getEntityPart(entity) then maintenanceEntities[#maintenanceEntities + 1] = entity stackedCountCache += 1 else stackedEntities[entity] = nil end end end local function forgetEntityVisualState(entity) local objects = { entity } for _, descendant in ipairs(entity:GetDescendants()) do objects[#objects + 1] = descendant end for _, object in ipairs(objects) do hiddenParts[object] = nil hiddenVisuals[object] = nil end end local function getEntityCFrame(entity) if entity:IsA("BasePart") then return entity.CFrame end if entity:IsA("Model") and getEntityPart(entity) then return entity:GetPivot() end return nil end local function setEntityCFrame(entity, targetCFrame) if entity:IsA("BasePart") then entity.AssemblyLinearVelocity = Vector3.zero entity.AssemblyAngularVelocity = Vector3.zero entity.CFrame = targetCFrame return true end if entity:IsA("Model") and getEntityPart(entity) then entity:PivotTo(targetCFrame) for _, descendant in ipairs(entity:GetDescendants()) do if descendant:IsA("BasePart") then descendant.AssemblyLinearVelocity = Vector3.zero descendant.AssemblyAngularVelocity = Vector3.zero end end return true end return false end local function moveEntitiesTogether(entities, targetCFrame) local bulkParts = {} local bulkCFrames = {} local models = {} local movedCount = 0 for _, entity in ipairs(entities) do if entity and entity.Parent == balls then if entity:IsA("BasePart") then entity.AssemblyLinearVelocity = Vector3.zero entity.AssemblyAngularVelocity = Vector3.zero bulkParts[#bulkParts + 1] = entity bulkCFrames[#bulkCFrames + 1] = targetCFrame elseif entity:IsA("Model") and getEntityPart(entity) then models[#models + 1] = entity end end end if #bulkParts > 0 then local ok = pcall(function() workspace:BulkMoveTo( bulkParts, bulkCFrames, Enum.BulkMoveMode.FireCFrameChanged ) end) if not ok then for _, part in ipairs(bulkParts) do pcall(setEntityCFrame, part, targetCFrame) end end movedCount += #bulkParts end for _, model in ipairs(models) do local ok, moved = pcall(setEntityCFrame, model, targetCFrame) if ok and moved then movedCount += 1 end end return movedCount end local function hideEntityRendering(entity) local objects = { entity } for _, descendant in ipairs(entity:GetDescendants()) do objects[#objects + 1] = descendant end for _, object in ipairs(objects) do if object:IsA("BasePart") then if hiddenParts[object] == nil then hiddenParts[object] = { LocalTransparencyModifier = object.LocalTransparencyModifier, CastShadow = object.CastShadow, CanCollide = object.CanCollide, CanTouch = object.CanTouch, CanQuery = object.CanQuery, Massless = object.Massless, Anchored = object.Anchored, } else local saved = hiddenParts[object] if saved.CanTouch == nil then saved.CanTouch = object.CanTouch end if saved.CanQuery == nil then saved.CanQuery = object.CanQuery end if saved.Anchored == nil then saved.Anchored = object.Anchored end end if object.LocalTransparencyModifier ~= 1 then object.LocalTransparencyModifier = 1 end if object.CastShadow then object.CastShadow = false end if object.CanCollide then object.CanCollide = false end if object.CanTouch then object.CanTouch = false end if object.CanQuery then object.CanQuery = false end if not object.Massless then object.Massless = true end if not object.Anchored then object.Anchored = true object.AssemblyLinearVelocity = Vector3.zero object.AssemblyAngularVelocity = Vector3.zero end elseif ( object:IsA("ParticleEmitter") or object:IsA("Trail") or object:IsA("Beam") or object:IsA("Smoke") or object:IsA("Fire") or object:IsA("Sparkles") or object:IsA("BillboardGui") or object:IsA("SurfaceGui") or object:IsA("Highlight") or object:IsA("PointLight") or object:IsA("SpotLight") or object:IsA("SurfaceLight") ) then if hiddenVisuals[object] == nil then hiddenVisuals[object] = { property = "Enabled", value = object.Enabled, } end if object.Enabled then object.Enabled = false end elseif object:IsA("Decal") or object:IsA("Texture") then if hiddenVisuals[object] == nil then hiddenVisuals[object] = { property = "Transparency", value = object.Transparency, } end if object.Transparency ~= 1 then object.Transparency = 1 end end end end local function restorePart(part) local saved = hiddenParts[part] if saved == nil then return end if part.Parent then pcall(function() part.LocalTransparencyModifier = saved.LocalTransparencyModifier part.CastShadow = saved.CastShadow part.CanCollide = saved.CanCollide if saved.CanTouch ~= nil then part.CanTouch = saved.CanTouch end if saved.CanQuery ~= nil then part.CanQuery = saved.CanQuery end part.Massless = saved.Massless if saved.Anchored ~= nil then part.Anchored = saved.Anchored end end) end hiddenParts[part] = nil end local function restoreVisual(object) local saved = hiddenVisuals[object] if saved == nil then return end if object.Parent then pcall(function() if type(saved) == "table" then object[saved.property] = saved.value else object.Enabled = saved end end) end hiddenVisuals[object] = nil end local function showEntityRendering(entity) local objects = { entity } for _, descendant in ipairs(entity:GetDescendants()) do objects[#objects + 1] = descendant end for _, object in ipairs(objects) do if object:IsA("BasePart") then restorePart(object) else restoreVisual(object) end end end local function restoreAllRendering() for part in pairs(hiddenParts) do restorePart(part) end for object in pairs(hiddenVisuals) do restoreVisual(object) end end local function destroyBallStackMarker() local existingMarker = workspace:FindFirstChild("GolfYardBallStackMarker") if existingMarker and existingMarker ~= ballStackMarker then existingMarker:Destroy() end if ballStackMarker then ballStackMarker:Destroy() ballStackMarker = nil ballStackLabel = nil end end local collectingStack = false local function collectHiddenStack() if collectingStack or not ballStackActive then return end collectingStack = true task.spawn(function() local entities = {} for entity in pairs(stackedEntities) do if entity and entity.Parent == balls then entities[#entities + 1] = entity end end local batchSize = math.clamp(CONFIG.BatchSize, 1, 1000) local sent = 0 for first = 1, #entities, batchSize do if not running or not ballStackActive then break end local batch = {} local last = math.min(first + batchSize - 1, #entities) for index = first, last do batch[#batch + 1] = entities[index] end if #batch > 0 then safeFire("Collect2", batch) sent += #batch sellStatus = string.format("Collecting hidden stack: %d/%d", sent, #entities) task.wait(math.max(0.03, numericAttribute("CollectCooldown", 0.1))) end end collectingStack = false updateBallStackMarker() end) end local function createBallStackMarker(stackCFrame, count) destroyBallStackMarker() local marker = Instance.new("Part") marker.Name = "GolfYardBallStackMarker" marker.Shape = Enum.PartType.Cylinder marker.Size = Vector3.new(0.3, 4, 4) marker.CFrame = stackCFrame * CFrame.new(0, -2.65, 0) * CFrame.Angles(0, 0, math.rad(90)) marker.Anchored = true marker.CanCollide = false marker.CanTouch = false marker.CanQuery = false marker.CastShadow = false marker.Material = Enum.Material.Neon marker.Color = Color3.fromRGB(170, 100, 255) marker.Transparency = 0.2 marker.Parent = workspace local prompt = Instance.new("ProximityPrompt") prompt.Name = "CollectHiddenBalls" prompt.ActionText = "Collect Balls" prompt.ObjectText = string.format("%d Hidden Balls", count) prompt.HoldDuration = 0 prompt.MaxActivationDistance = 18 prompt.RequiresLineOfSight = false prompt.KeyboardKeyCode = Enum.KeyCode.E prompt.GamepadKeyCode = Enum.KeyCode.ButtonX prompt.Parent = marker prompt.Triggered:Connect(function(triggeringPlayer) if triggeringPlayer == player then collectHiddenStack() end end) local billboard = Instance.new("BillboardGui") billboard.Name = "StackDisplay" billboard.Size = UDim2.fromOffset(190, 58) billboard.StudsOffset = Vector3.new(0, 3.1, 0) billboard.AlwaysOnTop = true billboard.MaxDistance = 500 billboard.Parent = marker local label = Instance.new("TextLabel") label.Size = UDim2.fromScale(1, 1) label.BackgroundColor3 = Color3.fromRGB(24, 28, 38) label.BackgroundTransparency = 0.1 label.BorderSizePixel = 0 label.Text = string.format("BALL STACK\n%d hidden balls", count) label.TextColor3 = Color3.fromRGB(245, 247, 252) label.TextSize = 13 label.Font = Enum.Font.GothamBold label.TextWrapped = true label.Parent = billboard local labelCorner = Instance.new("UICorner") labelCorner.CornerRadius = UDim.new(0, 7) labelCorner.Parent = label ballStackMarker = marker ballStackLabel = label end local function updateBallStackMarker() local count = stackedCountCache if ballStackLabel then ballStackLabel.Text = string.format("BALL STACK\n%d hidden balls", count) end if ballStackActive and count == 0 then ballStackActive = false ballStackCFrame = nil restoreAllRendering() destroyBallStackMarker() table.clear(stackedEntities) syncPersistedStackState() sellStatus = "All stacked balls collected" end return count end local function restoreBallStack(restorePositions) ballStackActive = false for entity, originalCFrame in pairs(stackedEntities) do if entity and entity.Parent then if restorePositions and originalCFrame then pcall(setEntityCFrame, entity, originalCFrame) end showEntityRendering(entity) end end table.clear(stackedEntities) table.clear(maintenanceEntities) stackedCountCache = 0 maintenanceIndex = 0 restoreAllRendering() destroyBallStackMarker() ballStackCFrame = nil syncPersistedStackState() end local function applyExistingStack() local entities = {} if ballStackActive and ballStackCFrame then for entity in pairs(stackedEntities) do if entity and entity.Parent == balls and getEntityPart(entity) then hideEntityRendering(entity) entities[#entities + 1] = entity else stackedEntities[entity] = nil end end elseif resumeSnapshot and resumeSnapshot.cframe then ballStackCFrame = resumeSnapshot.cframe for _, entity in ipairs(resumeSnapshot.entities) do if entity and entity.Parent == balls and getEntityPart(entity) then local originalCFrame = getEntityCFrame(entity) if originalCFrame then stackedEntities[entity] = originalCFrame hideEntityRendering(entity) entities[#entities + 1] = entity end end end ballStackActive = #entities > 0 end if ballStackActive and ballStackCFrame and #entities > 0 then moveEntitiesTogether(entities, ballStackCFrame) createBallStackMarker(ballStackCFrame, #entities) sellStatus = string.format("Resumed %d hidden balls", #entities) elseif ballStackActive then ballStackActive = false ballStackCFrame = nil end rebuildStackCache() syncPersistedStackState() end local function bringAllBallsStacked() if ballStackActive then restoreBallStack(true) sellStatus = "Ball stack restored" return end local _, root = getCharacterParts() if not root then sellStatus = "No character" return end local stackCFrame = root.CFrame * CFrame.new(0, 0, -6) local entities = {} for _, entity in ipairs(balls:GetChildren()) do if getEntityPart(entity) then local originalCFrame = getEntityCFrame(entity) if originalCFrame then stackedEntities[entity] = originalCFrame hideEntityRendering(entity) entities[#entities + 1] = entity end end end if #entities == 0 then restoreBallStack(false) sellStatus = "No balls found" return end local movedCount = moveEntitiesTogether(entities, stackCFrame) if movedCount == 0 then restoreBallStack(true) sellStatus = "Ball move failed" return end ballStackActive = true ballStackCFrame = stackCFrame rebuildStackCache() createBallStackMarker(stackCFrame, stackedCountCache) syncPersistedStackState() sellStatus = string.format("Stacked %d hidden balls", movedCount) end applyExistingStack() local previousGui = playerGui:FindFirstChild("GolfYard") if previousGui then previousGui:Destroy() end local gui = Instance.new("ScreenGui") gui.Name = "GolfYard" gui.ResetOnSpawn = false gui.ZIndexBehavior = Enum.ZIndexBehavior.Sibling gui.Parent = playerGui local window = Instance.new("Frame") window.Name = "Window" window.Size = UDim2.fromOffset(330, 430) window.Position = UDim2.new(0, 24, 0.5, -215) window.BackgroundColor3 = Color3.fromRGB(24, 28, 38) window.BorderSizePixel = 0 window.Active = true window.Draggable = true window.Parent = gui local windowCorner = Instance.new("UICorner") windowCorner.CornerRadius = UDim.new(0, 10) windowCorner.Parent = window local title = Instance.new("TextLabel") title.Size = UDim2.new(1, -48, 0, 42) title.Position = UDim2.fromOffset(14, 0) title.BackgroundTransparency = 1 title.Text = "Golf Yard" title.TextColor3 = Color3.fromRGB(240, 243, 250) title.TextSize = 17 title.Font = Enum.Font.GothamBold title.TextXAlignment = Enum.TextXAlignment.Left title.Parent = window local close = Instance.new("TextButton") close.Size = UDim2.fromOffset(32, 32) close.Position = UDim2.new(1, -38, 0, 5) close.BackgroundColor3 = Color3.fromRGB(170, 58, 68) close.BorderSizePixel = 0 close.Text = "×" close.TextColor3 = Color3.new(1, 1, 1) close.TextSize = 22 close.Font = Enum.Font.GothamBold close.Parent = window local closeCorner = Instance.new("UICorner") closeCorner.CornerRadius = UDim.new(0, 8) closeCorner.Parent = close local content = Instance.new("ScrollingFrame") content.Name = "Content" content.Size = UDim2.new(1, -20, 1, -52) content.Position = UDim2.fromOffset(10, 44) content.BackgroundTransparency = 1 content.BorderSizePixel = 0 content.ScrollBarThickness = 4 content.ScrollBarImageColor3 = Color3.fromRGB(95, 108, 140) content.CanvasSize = UDim2.new() content.AutomaticCanvasSize = Enum.AutomaticSize.Y content.ScrollingDirection = Enum.ScrollingDirection.Y content.Parent = window local layout = Instance.new("UIListLayout") layout.Padding = UDim.new(0, 6) layout.SortOrder = Enum.SortOrder.LayoutOrder layout.Parent = content local bottomPadding = Instance.new("UIPadding") bottomPadding.PaddingBottom = UDim.new(0, 8) bottomPadding.Parent = content local function round(object) local corner = Instance.new("UICorner") corner.CornerRadius = UDim.new(0, 7) corner.Parent = object end local function sectionLabel(text) local label = Instance.new("TextLabel") label.Size = UDim2.new(1, -6, 0, 24) label.BackgroundTransparency = 1 label.Text = text label.TextColor3 = Color3.fromRGB(132, 151, 194) label.TextSize = 12 label.Font = Enum.Font.GothamBold label.TextXAlignment = Enum.TextXAlignment.Left label.Parent = content return label end local function toggleButton(label, configKey, onChanged) local button = Instance.new("TextButton") button.Size = UDim2.new(1, -6, 0, 34) button.BorderSizePixel = 0 button.TextColor3 = Color3.fromRGB(245, 247, 252) button.TextSize = 14 button.Font = Enum.Font.GothamMedium button.Parent = content round(button) local function refresh() local enabled = CONFIG[configKey] button.Text = label .. ": " .. (enabled and "ON" or "OFF") button.BackgroundColor3 = enabled and Color3.fromRGB(48, 142, 96) or Color3.fromRGB(55, 61, 78) end button.MouseButton1Click:Connect(function() CONFIG[configKey] = not CONFIG[configKey] refresh() if onChanged then onChanged(CONFIG[configKey]) end end) refresh() return button end local function actionButton(text, callback, color) local button = Instance.new("TextButton") button.Size = UDim2.new(1, -6, 0, 34) button.BackgroundColor3 = color or Color3.fromRGB(62, 91, 151) button.BorderSizePixel = 0 button.Text = text button.TextColor3 = Color3.fromRGB(245, 247, 252) button.TextSize = 14 button.Font = Enum.Font.GothamMedium button.Parent = content round(button) button.MouseButton1Click:Connect(function() local ok, result = pcall(callback) if not ok then sellStatus = "Action failed" elseif type(result) == "string" then sellStatus = result end end) return button end local function numericRow(labelText, configKey, minimum, maximum, step, onChanged) local row = Instance.new("Frame") row.Size = UDim2.new(1, -6, 0, 34) row.BackgroundColor3 = Color3.fromRGB(55, 61, 78) row.BorderSizePixel = 0 row.Parent = content round(row) local label = Instance.new("TextLabel") label.Size = UDim2.fromOffset(104, 34) label.Position = UDim2.fromOffset(10, 0) label.BackgroundTransparency = 1 label.Text = labelText label.TextColor3 = Color3.fromRGB(245, 247, 252) label.TextSize = 14 label.Font = Enum.Font.GothamMedium label.TextXAlignment = Enum.TextXAlignment.Left label.Parent = row local input = Instance.new("TextBox") input.Size = UDim2.fromOffset(92, 26) input.Position = UDim2.fromOffset(112, 4) input.BackgroundColor3 = Color3.fromRGB(37, 42, 55) input.BorderSizePixel = 0 input.ClearTextOnFocus = false input.Text = tostring(CONFIG[configKey]) input.PlaceholderText = string.format("%d-%d", minimum, maximum) input.TextColor3 = Color3.fromRGB(245, 247, 252) input.TextSize = 14 input.Font = Enum.Font.GothamMedium input.Parent = row round(input) local function apply(value) value = tonumber(value) or CONFIG[configKey] value = math.clamp(math.floor(value + 0.5), minimum, maximum) CONFIG[configKey] = value input.Text = tostring(value) if onChanged then onChanged(value) end end input.FocusLost:Connect(function() apply(input.Text) end) local function makeStepButton(text, xOffset, change) local button = Instance.new("TextButton") button.Size = UDim2.fromOffset(42, 26) button.Position = UDim2.new(1, xOffset, 0, 4) button.BackgroundColor3 = Color3.fromRGB(77, 86, 109) button.BorderSizePixel = 0 button.Text = text button.TextColor3 = Color3.new(1, 1, 1) button.TextSize = 18 button.Font = Enum.Font.GothamBold button.Parent = row round(button) button.MouseButton1Click:Connect(function() apply(CONFIG[configKey] + change) end) end makeStepButton("−", -90, -step) makeStepButton("+", -44, step) return row end sectionLabel("FARMING") toggleButton("Auto Farm", "AutoFarm") toggleButton("Teleport Mode", "TeleportMode") toggleButton("Auto Sell", "AutoSell") toggleButton("Sell Only When Full", "SellOnlyWhenFull") toggleButton("Auto Upgrade All", "AutoUpgradeAll") numericRow("Batch Size", "BatchSize", 1, 1000, 5) local bringBallsButton = actionButton("Bring All Balls", bringAllBallsStacked, Color3.fromRGB(133, 83, 168)) actionButton("Collect Hidden Stack", function() if not ballStackActive then sellStatus = "No active ball stack" return end collectHiddenStack() end, Color3.fromRGB(74, 126, 163)) actionButton("Sell Now", function() if not bagHasBalls() then sellStatus = "Bag empty" return end sellBag(true) end) actionButton("Toggle Golf Kart", function() safeFire("ToggleGolfKart") end) local status = Instance.new("TextLabel") status.Size = UDim2.new(1, -6, 0, 40) status.BackgroundTransparency = 1 status.TextColor3 = Color3.fromRGB(177, 187, 210) status.TextSize = 12 status.Font = Enum.Font.Gotham status.TextWrapped = true status.TextXAlignment = Enum.TextXAlignment.Left status.Parent = content local function cleanup(preserveStack) if not running then return end running = false if preserveStack and ballStackActive then syncPersistedStackState() destroyBallStackMarker() else restoreBallStack(true) sharedEnvironment.__GolfYardStackState = nil end for _, connection in ipairs(connections) do pcall(function() connection:Disconnect() end) end table.clear(connections) if gui and gui.Parent then gui:Destroy() end if sharedEnvironment.__GolfYardCleanup == cleanup then sharedEnvironment.__GolfYardCleanup = nil end end sharedEnvironment.__GolfYardCleanup = cleanup connections[#connections + 1] = UserInputService.InputBegan:Connect(function(input, processed) if not processed and not UserInputService:GetFocusedTextBox() and input.KeyCode == Enum.KeyCode.RightShift then gui.Enabled = not gui.Enabled end end) close.MouseButton1Click:Connect(cleanup) task.spawn(function() while running do local stackedCount = updateBallStackMarker() bringBallsButton.Text = ballStackActive and "Restore Ball Stack" or "Bring All Balls" status.Text = string.format( "Bag: %s/%s Range: %s\n%s%s", tostring(player:GetAttribute("BagCount") or "?"), tostring(player:GetAttribute("BagCapacity") or "?"), tostring(player:GetAttribute("CollectionRange") or 60), sellStatus, ballStackActive and string.format(" Stack: ACTIVE (%d)", stackedCount) or "" ) task.wait(0.5) end end) task.spawn(function() while running do if ballStackActive and #maintenanceEntities > 0 then maintenanceIndex += 1 if maintenanceIndex > #maintenanceEntities then maintenanceIndex = 1 end local entity = maintenanceEntities[maintenanceIndex] if entity and entity.Parent == balls and stackedEntities[entity] ~= nil then hideEntityRendering(entity) else rebuildStackCache() updateBallStackMarker() syncPersistedStackState() end end task.wait(0.05) end end) connections[#connections + 1] = balls.ChildAdded:Connect(function(entity) if not ballStackActive or not ballStackCFrame then return end task.defer(function() if not running or not ballStackActive or entity.Parent ~= balls then return end local part = getEntityPart(entity) if not part then return end if (part.Position - ballStackCFrame.Position).Magnitude <= 3 then if stackedEntities[entity] == nil then stackedEntities[entity] = getEntityCFrame(entity) or ballStackCFrame end hideEntityRendering(entity) pcall(setEntityCFrame, entity, ballStackCFrame) rebuildStackCache() updateBallStackMarker() syncPersistedStackState() end end) end) connections[#connections + 1] = balls.ChildRemoved:Connect(function(entity) if stackedEntities[entity] == nil then return end stackedEntities[entity] = nil forgetEntityVisualState(entity) rebuildStackCache() updateBallStackMarker() syncPersistedStackState() end) task.spawn(function() while running do if CONFIG.AutoUpgradeAll then safeFire("BuyAllShop") end task.wait(0.5) end end) task.spawn(function() while running do if CONFIG.AutoSell and bagHasBalls() then local shouldSell = not CONFIG.SellOnlyWhenFull or bagIsFull() if shouldSell then sellBag(true) end end task.wait(0.25) end end) task.spawn(function() while running do if not CONFIG.AutoFarm then task.wait(0.2) continue end local cooldown = math.max(0.05, numericAttribute("CollectCooldown", 0.1)) if CONFIG.AutoSell and bagIsFull() then task.wait(cooldown) continue end local _, root = getCharacterParts() local readyToCollect = root ~= nil if root and CONFIG.TeleportMode then local target = nextTarget() readyToCollect = target ~= nil if target then local moved = pcall(function() root.AssemblyLinearVelocity = Vector3.zero root.AssemblyAngularVelocity = Vector3.zero root.CFrame = CFrame.new(target.Position + Vector3.new(0, 3, 0)) end) readyToCollect = moved if moved then task.wait(0.05) end end end if root and readyToCollect then local batch = collectBatch(root.Position) if #batch > 0 then safeFire("Collect2", batch) end end task.wait(cooldown) end end)