local Players = game:GetService("Players") local ReplicatedStorage = game:GetService("ReplicatedStorage") local player = Players.LocalPlayer local playerGui = player:WaitForChild("PlayerGui") local countriesFolder = ReplicatedStorage:WaitForChild("Countries") local purchaseRemote = ReplicatedStorage:WaitForChild("Cities"):WaitForChild("PurchaseFactory") local running = false -- UI local screenGui = Instance.new("ScreenGui") screenGui.Name = "AutoFarmUI" screenGui.ResetOnSpawn = false screenGui.Parent = playerGui local button = Instance.new("TextButton") button.Size = UDim2.new(0, 200, 0, 60) button.Position = UDim2.new(0, 20, 0, 20) button.Text = "OFF" button.BackgroundColor3 = Color3.fromRGB(200, 60, 60) button.TextColor3 = Color3.fromRGB(255, 255, 255) button.Parent = screenGui -- Drag system (mobile + PC) local dragging = false local dragStart local startPos button.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then dragging = true dragStart = input.Position startPos = button.Position end end) button.InputEnded:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then dragging = false end end) game:GetService("UserInputService").InputChanged:Connect(function(input) if dragging and (input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch) then local delta = input.Position - dragStart button.Position = UDim2.new( startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y ) end end) -- Toggle local function setState(state) running = state if running then button.Text = "ON" button.BackgroundColor3 = Color3.fromRGB(60, 200, 90) else button.Text = "OFF" button.BackgroundColor3 = Color3.fromRGB(200, 60, 60) end end button.MouseButton1Click:Connect(function() setState(not running) if running then task.spawn(function() while running do for _, country in pairs(countriesFolder:GetChildren()) do local cities = country:FindFirstChild("Cities") if cities then for _, city in pairs(cities:GetChildren()) do if not running then return end pcall(function() purchaseRemote:FireServer(city) end) end end end task.wait(1) end end) end end) setState(false)