local Players = game:GetService("Players") local Workspace = game:GetService("Workspace") local UserInputService = game:GetService("UserInputService") local LocalPlayer = Players.LocalPlayer local isRunning = true -- Toggle on/off when pressing E UserInputService.InputBegan:Connect(function(input, gameProcessed) if input.KeyCode == Enum.KeyCode.E then isRunning = not isRunning if isRunning then print("Cookie Auto-Farm: RESUMED") else print("Cookie Auto-Farm: PAUSED") end end end) local function getRootPart() local character = LocalPlayer.Character return character and character:FindFirstChild("HumanoidRootPart") end local function collectCookie(cookie) local rootPart = getRootPart() if not rootPart then return end local targetPart = nil if cookie:IsA("Model") then targetPart = cookie.PrimaryPart or cookie:FindFirstChildWhichIsA("BasePart", true) elseif cookie:IsA("BasePart") then targetPart = cookie end if targetPart then rootPart.CFrame = targetPart.CFrame + Vector3.new(0, 3, 0) local prompt = cookie:FindFirstChildWhichIsA("ProximityPrompt", true) if prompt then if fireproximityprompt then fireproximityprompt(prompt) else prompt:InputHoldBegin() task.wait(0.05) prompt:InputHoldEnd() end end task.wait(0.15) end end -- Run auto-farm loop with toggle checks task.spawn(function() local map = Workspace:WaitForChild("Map", 5) local functional = map and map:WaitForChild("Functional", 5) local spawnedItems = functional and functional:WaitForChild("SpawnedItems", 5) if not spawnedItems then warn("Could not locate Workspace.Map.Functional.SpawnedItems") return end print("Cookie Auto-Farm active! Press 'E' to pause/resume.") while true do if isRunning then for _, item in ipairs(spawnedItems:GetChildren()) do if not isRunning then break end -- Stop mid-loop if paused if item.Name == "CookieObject" then collectCookie(item) end end end task.wait(0.2) end end)