local player = game.Players.LocalPlayer local myfac -- 🔍 Find your tycoon for i, v in pairs(game.workspace.Tycoons:GetChildren()) do if v:FindFirstChild("Owner") and v.Owner.Value == player.Name then myfac = v break end end if not myfac then warn("Tycoon not found!") return end -- ⚙️ Safe proximity prompt function local function firePrompt(internalPart) if internalPart and internalPart:FindFirstChild("ProximityPrompt") then local prompt = internalPart.ProximityPrompt prompt.MaxActivationDistance = math.huge -- ✅ infinite range fireproximityprompt(prompt, math.huge) print("Fired prompt at", internalPart.Name) else warn("ProximityPrompt not found in", internalPart and internalPart.Name or "nil") end end -- 🍭 Candy setup local candyFurnace = myfac:FindFirstChild("Candy Metropolis") local candyMax = candyFurnace and 25000 or 0 -- 💬 Auto-click "Yes" on collection GUI local gui = player.PlayerGui:WaitForChild("GUI") local inputPrompt = gui:WaitForChild("InputPrompt") local absorb = inputPrompt:WaitForChild("Absorb") absorb.Changed:Connect(function(property) if property == "Visible" and absorb.Visible then local text = string.sub(inputPrompt.InputPrompt.Title.Text, 1, 25) if text == "Would you like to collect" then for _, connection in pairs(getconnections(inputPrompt.InputPrompt.Yes.MouseButton1Click)) do connection:Fire() end end end end) -- 🧩 Create GUI local screenGui = Instance.new("ScreenGui") screenGui.Name = "CandyMineAutomation" screenGui.ResetOnSpawn = false screenGui.Parent = player:WaitForChild("PlayerGui") local frame = Instance.new("Frame") frame.Size = UDim2.new(0, 260, 0, 140) frame.Position = UDim2.new(0.05, 0, 0.2, 0) frame.BackgroundColor3 = Color3.fromRGB(30, 30, 30) frame.BorderSizePixel = 0 frame.Active = true frame.Draggable = true frame.Parent = screenGui local title = Instance.new("TextLabel") title.Size = UDim2.new(1, 0, 0, 30) title.BackgroundColor3 = Color3.fromRGB(40, 40, 40) title.Text = "Candy + Mine Automation" title.TextColor3 = Color3.fromRGB(255, 255, 255) title.Font = Enum.Font.GothamBold title.TextSize = 14 title.Parent = frame local progressBarBG = Instance.new("Frame") progressBarBG.Size = UDim2.new(1, -20, 0, 20) progressBarBG.Position = UDim2.new(0, 10, 0, 40) progressBarBG.BackgroundColor3 = Color3.fromRGB(50, 50, 50) progressBarBG.Parent = frame local progressBar = Instance.new("Frame") progressBar.Size = UDim2.new(0, 0, 1, 0) progressBar.BackgroundColor3 = Color3.fromRGB(0, 220, 100) progressBar.Parent = progressBarBG local statusLabel = Instance.new("TextLabel") statusLabel.Size = UDim2.new(1, 0, 0, 25) statusLabel.Position = UDim2.new(0, 0, 0, 65) statusLabel.BackgroundTransparency = 1 statusLabel.Text = "Candy: 0 / 25000" statusLabel.TextColor3 = Color3.fromRGB(255, 255, 255) statusLabel.Font = Enum.Font.Gotham statusLabel.TextSize = 14 statusLabel.Parent = frame -- 🔴 Buttons start red local candyBtn = Instance.new("TextButton") candyBtn.Size = UDim2.new(0.45, 0, 0, 30) candyBtn.Position = UDim2.new(0.05, 0, 1, -40) candyBtn.BackgroundColor3 = Color3.fromRGB(220, 50, 50) candyBtn.Text = "Toggle Candy" candyBtn.TextColor3 = Color3.fromRGB(255, 255, 255) candyBtn.Font = Enum.Font.GothamBold candyBtn.TextSize = 14 candyBtn.Parent = frame local mineBtn = Instance.new("TextButton") mineBtn.Size = UDim2.new(0.45, 0, 0, 30) mineBtn.Position = UDim2.new(0.5, 0, 1, -40) mineBtn.BackgroundColor3 = Color3.fromRGB(220, 50, 50) mineBtn.Text = "Toggle Mine" mineBtn.TextColor3 = Color3.fromRGB(255, 255, 255) mineBtn.Font = Enum.Font.GothamBold mineBtn.TextSize = 14 mineBtn.Parent = frame -- 🔁 Automation logic local candyEnabled = false local mineEnabled = false candyBtn.MouseButton1Click:Connect(function() candyEnabled = not candyEnabled if candyEnabled then candyBtn.BackgroundColor3 = Color3.fromRGB(0, 200, 100) -- green else candyBtn.BackgroundColor3 = Color3.fromRGB(220, 50, 50) -- red end end) mineBtn.MouseButton1Click:Connect(function() mineEnabled = not mineEnabled if mineEnabled then mineBtn.BackgroundColor3 = Color3.fromRGB(0, 200, 100) -- green else mineBtn.BackgroundColor3 = Color3.fromRGB(220, 50, 50) -- red end end) -- 🧠 Main loop task.spawn(function() while task.wait(0.5) do if candyFurnace then local candyAmount = tonumber(candyFurnace.Model.CounterPart.CandyTracker.Background.Amount.Text) or 0 local ratio = math.clamp(candyAmount / candyMax, 0, 1) progressBar.Size = UDim2.new(ratio, 0, 1, 0) statusLabel.Text = string.format("Candy: %d / %d", candyAmount, candyMax) if candyEnabled and candyAmount >= candyMax then firePrompt(candyFurnace.Model.Internal) end end if mineEnabled then local pumpkinMine = myfac:FindFirstChild("Pumpkinite Mine") if pumpkinMine then firePrompt(pumpkinMine.Model.Internal) end end end end)