local farmActive = false -- Function to handle firing RemoteEvent local function fireRemoteEvent(tool) if tool:IsA("Tool") and tool:FindFirstChild("Handle") then local script = tool.Handle:FindFirstChild("Script") if script and script:FindFirstChild("RemoteEvent") then for i = 1, 10 do script.RemoteEvent:FireServer() end return true end end return false end -- Function to start or stop farming local function toggleFarming() if farmActive then -- Stop farming farmActive = false print("Farming stopped.") else -- Start farming farmActive = true print("Farming started.") while farmActive do wait() local player = game:GetService("Players").LocalPlayer if not player then print("No LocalPlayer found.") return end local character = player.Character local backpack = player.Backpack -- Check tools in Character if character then local children = character:GetChildren() for i = 1, #children do local tool = children[i] if tool:IsA("Tool") and fireRemoteEvent(tool) then break end end end -- Check tools in Backpack if not found in Character local backpackChildren = backpack:GetChildren() for i = 1, #backpackChildren do local tool = backpackChildren[i] if tool:IsA("Tool") and fireRemoteEvent(tool) then break end end end end end -- Listen for chat commands game:GetService("Players").LocalPlayer.Chatted:Connect(function(message) local trimmedMessage = message:lower():gsub("^%s*(.-)%s*$", "%1") -- Trim whitespace if trimmedMessage == "farm" then toggleFarming() elseif trimmedMessage == "unfarm" then farmActive = false print("Farming stopped.") end end) print("Script loaded successfully.")