local Players = game:GetService("Players") local player = Players.LocalPlayer local isFarming = false local farmCoroutine = nil local function farmAction() for _, tool in ipairs(player.Backpack:GetChildren()) do if tool:IsA("Tool") and tool.Name:match("^Sword") then local handle = tool:FindFirstChild("Handle") local scriptFolder = handle and handle:FindFirstChild("Script") local remote = scriptFolder and scriptFolder:FindFirstChild("RemoteEvent") if remote and remote:IsA("RemoteEvent") then remote:FireServer() end task.wait(0.03) end end end local function startFarming() isFarming = true farmCoroutine = coroutine.create(function() while isFarming do farmAction() task.wait(0) end end) coroutine.resume(farmCoroutine) toggleButton.Text = "Stop" toggleButton.BackgroundColor3 = Color3.fromRGB(255, 0, 0) end local function stopFarming() isFarming = false if farmCoroutine then farmCoroutine = nil end toggleButton.Text = "Start" toggleButton.BackgroundColor3 = Color3.fromRGB(0, 255, 0) end local screenGui = Instance.new("ScreenGui") screenGui.Name = "FarmGUI" screenGui.Parent = player.PlayerGui local mainFrame = Instance.new("Frame") mainFrame.Size = UDim2.new(0, 150, 0, 80) mainFrame.Position = UDim2.new(0.5, -75, 0.5, -40) mainFrame.BackgroundColor3 = Color3.fromRGB(200, 200, 200) mainFrame.BackgroundTransparency = 0 mainFrame.BorderSizePixel = 2 mainFrame.BorderColor3 = Color3.fromRGB(0, 0, 0) mainFrame.Active = true mainFrame.Draggable = true mainFrame.Parent = screenGui local titleLabel = Instance.new("TextLabel") titleLabel.Size = UDim2.new(1, 0, 0, 25) titleLabel.Position = UDim2.new(0, 0, 0, 0) titleLabel.BackgroundColor3 = Color3.fromRGB(150, 150, 150) titleLabel.BackgroundTransparency = 0 titleLabel.BorderSizePixel = 2 titleLabel.BorderColor3 = Color3.fromRGB(0, 0, 0) titleLabel.Text = "Auto Farm" titleLabel.TextColor3 = Color3.fromRGB(0, 0, 0) titleLabel.TextSize = 16 titleLabel.TextScaled = false titleLabel.Font = Enum.Font.SourceSansBold titleLabel.Parent = mainFrame local toggleButton = Instance.new("TextButton") toggleButton.Size = UDim2.new(0.6, 0, 0, 25) toggleButton.Position = UDim2.new(0.2, 0, 0.4, 0) toggleButton.BackgroundColor3 = Color3.fromRGB(0, 255, 0) toggleButton.BackgroundTransparency = 0 toggleButton.BorderSizePixel = 2 toggleButton.BorderColor3 = Color3.fromRGB(0, 0, 0) toggleButton.Text = "Start" toggleButton.TextColor3 = Color3.fromRGB(0, 0, 0) toggleButton.TextSize = 14 toggleButton.Font = Enum.Font.SourceSansBold toggleButton.Parent = mainFrame toggleButton.MouseButton1Click:Connect(function() if isFarming then stopFarming() else startFarming() end end) local statusLabel = Instance.new("TextLabel") statusLabel.Size = UDim2.new(1, 0, 0, 15) statusLabel.Position = UDim2.new(0, 0, 0.75, 0) statusLabel.BackgroundTransparency = 1 statusLabel.Text = "Status: Stopped" statusLabel.TextColor3 = Color3.fromRGB(0, 0, 0) statusLabel.TextSize = 11 statusLabel.Font = Enum.Font.SourceSans statusLabel.Parent = mainFrame local originalStart = startFarming local originalStop = stopFarming startFarming = function() originalStart() statusLabel.Text = "Status: Farming" statusLabel.TextColor3 = Color3.fromRGB(0, 255, 0) end stopFarming = function() originalStop() statusLabel.Text = "Status: Stopped" statusLabel.TextColor3 = Color3.fromRGB(0, 0, 0) end local closeButton = Instance.new("TextButton") closeButton.Size = UDim2.new(0, 20, 0, 20) closeButton.Position = UDim2.new(1, -22, 0, 2) closeButton.BackgroundColor3 = Color3.fromRGB(200, 0, 0) closeButton.BackgroundTransparency = 0 closeButton.BorderSizePixel = 2 closeButton.BorderColor3 = Color3.fromRGB(0, 0, 0) closeButton.Text = "X" closeButton.TextColor3 = Color3.fromRGB(255, 255, 255) closeButton.TextSize = 12 closeButton.Font = Enum.Font.SourceSansBold closeButton.Parent = mainFrame closeButton.MouseButton1Click:Connect(function() if isFarming then stopFarming() end screenGui:Destroy() end)