-- Services local Players = game:GetService("Players") local Workspace = game:GetService("Workspace") local player = Players.LocalPlayer -- Blacklist Coordinates Memory Storage local collectedAphidPositions = {} -- Now indefinite (never cleared) local collectedFoodPositions = {} -- BACKGROUND CLEANER: Clears ONLY food blacklists every 10 seconds task.spawn(function() while true do task.wait(10) table.clear(collectedFoodPositions) end end) -- Team Destination Constants local RED_TEAM_RETURN = Vector3.new(698, 13, 765) local BLACK_TEAM_RETURN = Vector3.new(-740, 13, -822) -- Helper to find the correct return position based on Team Name local function getTeamReturnPosition(fallbackCFrame) if player.Team then local teamName = string.lower(player.Team.Name) if string.find(teamName, "red") then return CFrame.new(RED_TEAM_RETURN) elseif string.find(teamName, "black") then return CFrame.new(BLACK_TEAM_RETURN) end end return fallbackCFrame end -- Coordinate-Based Match Filters local function isPositionBlacklisted(targetPos, blacklistTable) for _, savedPos in ipairs(blacklistTable) do if (targetPos - savedPos).Magnitude < 3 then return true end end return false end -- Universal Interaction Utilities local function forceTouchItem(hrp, part) if not part or not part:IsA("BasePart") then return end if firetouchinterest then firetouchinterest(hrp, part, 0) task.wait(0.02) firetouchinterest(hrp, part, 1) end end local function refreshCharacter() local character = player.Character or player.CharacterAdded:Wait() local humanoidRootPart = character:WaitForChild("HumanoidRootPart", 5) return humanoidRootPart end -- Target Filter for Wild Aphids local function findNearestWildAphid() local nearestPart = nil local shortestDistance = math.huge local hrp = refreshCharacter() if not hrp then return nil end local myPos = hrp.Position for _, descendant in ipairs(Workspace:GetDescendants()) do if descendant:IsA("BasePart") then local nameLower = string.lower(descendant.Name) local parentNameLower = descendant.Parent and string.lower(descendant.Parent.Name) or "" if (string.find(nameLower, "aphid") or string.find(parentNameLower, "aphid")) and not string.find(nameLower, "zone") and not string.find(parentNameLower, "zone") and not string.find(nameLower, "delivery") then if descendant.Position.Y > -50 and descendant.Position.Y < 200 then if not isPositionBlacklisted(descendant.Position, collectedAphidPositions) then local distance = (descendant.Position - myPos).Magnitude if distance < shortestDistance and distance > 15 then shortestDistance = distance nearestPart = descendant end end end end end end return nearestPart end -- Target Finder for Foods local function getAllFoodParts() local foodParts = {} for _, descendant in ipairs(Workspace:GetDescendants()) do if descendant:IsA("BasePart") then local nameLower = string.lower(descendant.Name) local parentNameLower = descendant.Parent and string.lower(descendant.Parent.Name) or "" if (nameLower == "food" or parentNameLower == "food") and not string.find(nameLower, "aphid") and not string.find(parentNameLower, "aphid") and not string.find(nameLower, "zone") then table.insert(foodParts, descendant) end end end return foodParts end -- EXECUTOR ACTION DISPATCHERS local function runAphidAction() local hrp = refreshCharacter() if not hrp then return false end local targetPart = findNearestWildAphid() if not targetPart then return false end local originalCFrame = hrp.CFrame table.insert(collectedAphidPositions, targetPart.Position) hrp.CFrame = targetPart.CFrame task.wait(0.05) forceTouchItem(hrp, targetPart) task.wait(0.03) hrp.CFrame = getTeamReturnPosition(originalCFrame) return true end local function runFoodLoop(updateTextFunc) local hrp = refreshCharacter() if not hrp then return end local originalCFrame = hrp.CFrame local foodList = getAllFoodParts() if #foodList == 0 then if updateTextFunc then updateTextFunc("No Food Found!") end task.wait(1) return end while #foodList > 0 do if updateTextFunc then updateTextFunc("Left: " .. #foodList) end for _, part in ipairs(foodList) do if part and part.Parent then hrp.CFrame = part.CFrame task.wait(0.04) forceTouchItem(hrp, part) end end task.wait(0.1) foodList = getAllFoodParts() end hrp.CFrame = originalCFrame if updateTextFunc then updateTextFunc("Cleared!") end end -- COMPACT 2-OPTION GUI CONTAINER local ScreenGui = Instance.new("ScreenGui") ScreenGui.Name = "CleanStaticFarmGui" ScreenGui.ResetOnSpawn = false ScreenGui.Parent = player:WaitForChild("PlayerGui") local MainFrame = Instance.new("Frame") MainFrame.Size = UDim2.new(0, 190, 0, 122) MainFrame.Position = UDim2.new(1, -210, 0, 55) MainFrame.BackgroundColor3 = Color3.fromRGB(30, 30, 30) MainFrame.BorderSizePixel = 0 MainFrame.Active = true MainFrame.Parent = ScreenGui local UICorner = Instance.new("UICorner") UICorner.CornerRadius = UDim.new(0, 6) UICorner.Parent = MainFrame local TitleBar = Instance.new("TextLabel") TitleBar.Size = UDim2.new(1, 0, 0, 30) TitleBar.BackgroundColor3 = Color3.fromRGB(20, 20, 20) TitleBar.BorderSizePixel = 0 TitleBar.Text = " Ant Farm Hub v5.1" TitleBar.TextColor3 = Color3.fromRGB(220, 220, 220) TitleBar.Font = Enum.Font.SourceSansBold TitleBar.TextSize = 12 TitleBar.TextXAlignment = Enum.TextXAlignment.Left TitleBar.Parent = MainFrame local BarCorner = Instance.new("UICorner") BarCorner.CornerRadius = UDim.new(0, 6) BarCorner.Parent = TitleBar local MinButton = Instance.new("TextButton") MinButton.Size = UDim2.new(0, 50, 0, 20) MinButton.Position = UDim2.new(1, -56, 0, 5) MinButton.BackgroundColor3 = Color3.fromRGB(45, 45, 45) MinButton.BorderSizePixel = 0 MinButton.Text = "Hide" MinButton.TextColor3 = Color3.fromRGB(240, 240, 240) MinButton.Font = Enum.Font.SourceSansBold MinButton.TextSize = 11 MinButton.Parent = TitleBar local MinCorner = Instance.new("UICorner") MinCorner.CornerRadius = UDim.new(0, 4) MinCorner.Parent = MinButton local ContentFrame = Instance.new("Frame") ContentFrame.Size = UDim2.new(1, 0, 1, -30) ContentFrame.Position = UDim2.new(0, 0, 0, 30) ContentFrame.BackgroundTransparency = 1 ContentFrame.BorderSizePixel = 0 ContentFrame.Parent = MainFrame local menuVisible = true MinButton.MouseButton1Click:Connect(function() menuVisible = not menuVisible ContentFrame.Visible = menuVisible if menuVisible then MainFrame.Size = UDim2.new(0, 190, 0, 122) MinButton.Text = "Hide" MinButton.BackgroundColor3 = Color3.fromRGB(45, 45, 45) else MainFrame.Size = UDim2.new(0, 190, 0, 30) MinButton.Text = "Show" MinButton.BackgroundColor3 = Color3.fromRGB(0, 125, 0) end end) -- Button 1: Farm Aphid local B1 = Instance.new("TextButton") B1.Size = UDim2.new(1, -16, 0, 32) B1.Position = UDim2.new(0, 8, 0, 10) B1.BackgroundColor3 = Color3.fromRGB(45, 45, 45) B1.Text = "Farm Nearest Aphid" B1.TextColor3 = Color3.fromRGB(255, 255, 255) B1.Font = Enum.Font.SourceSansBold B1.TextSize = 12 B1.Parent = ContentFrame Instance.new("UICorner", B1).CornerRadius = UDim.new(0, 4) B1.MouseButton1Click:Connect(function() B1.Text = "Hunting..." local ok = runAphidAction() B1.Text = ok and "Farmed!" or "None Found!" task.wait(1) B1.Text = "Farm Nearest Aphid" end) -- Button 2: Farm Food Loop local B2 = Instance.new("TextButton") B2.Size = UDim2.new(1, -16, 0, 32) B2.Position = UDim2.new(0, 8, 0, 48) B2.BackgroundColor3 = Color3.fromRGB(45, 45, 45) B2.Text = "Farm Food Until Gone" B2.TextColor3 = Color3.fromRGB(255, 255, 255) B2.Font = Enum.Font.SourceSansBold B2.TextSize = 12 B2.Parent = ContentFrame Instance.new("UICorner", B2).CornerRadius = UDim.new(0, 4) B2.MouseButton1Click:Connect(function() runFoodLoop(function(txt) B2.Text = txt end) B2.Text = "Farm Food Until Gone" end)