local player = game.Players.LocalPlayer local running = false local delayTime = 0.03 -- fastest safe speed required 244 fps -- ===== Macro Logic ===== local function isUsable(obj) return obj:IsA("Tool") or obj:FindFirstChildOfClass("ClickDetector") or obj:IsA("RemoteEvent") end local function activate(obj) if obj:IsA("Tool") then obj.Parent = player.Character task.wait() obj:Activate() end local cd = obj:FindFirstChildOfClass("ClickDetector") if cd then pcall(function() fireclickdetector(cd) end) end if obj:IsA("RemoteEvent") then pcall(function() obj:FireServer() end) end end local function getAllItems() local list = {} local function scan(container) for _, obj in ipairs(container:GetChildren()) do if isUsable(obj) then table.insert(list, obj) end end end if player.Character then scan(player.Character) end scan(player.Backpack) return list end local function startMacro() if running then return end running = true task.spawn(function() while running do local items = getAllItems() for i = 1, #items do if not running then break end activate(items[i]) task.wait(delayTime) end end end) end local function stopMacro() running = false end -- ===== Chat Commands ===== player.Chatted:Connect(function(msg) local lowerMsg = msg:lower() if lowerMsg == "/farm" then startMacro() elseif lowerMsg == "/unfarm" then stopMacro() end end) -- ===== UI Setup ===== local screenGui = Instance.new("ScreenGui") screenGui.Name = "MacroUI" screenGui.Parent = player:WaitForChild("PlayerGui") -- main frame local frame = Instance.new("Frame") frame.Size = UDim2.fromOffset(200, 100) frame.Position = UDim2.fromScale(0.4,0.4) frame.BackgroundColor3 = Color3.fromRGB(30,30,30) frame.BorderSizePixel = 0 frame.Parent = screenGui -- top draggable bar with title local topBar = Instance.new("Frame") topBar.Size = UDim2.fromScale(1,0.25) topBar.BackgroundColor3 = Color3.fromRGB(50,50,50) topBar.BorderSizePixel = 0 topBar.Parent = frame local title = Instance.new("TextLabel") title.Size = UDim2.fromScale(1,1) title.BackgroundTransparency = 1 title.Text = "Made By Hexaphytes/Hamza" title.Font = Enum.Font.Montserrat title.TextColor3 = Color3.fromRGB(255,255,255) title.TextScaled = true title.Parent = topBar -- toggle button local toggleBtn = Instance.new("TextButton") toggleBtn.Size = UDim2.fromScale(1,0.75) toggleBtn.Position = UDim2.fromScale(0,0.25) toggleBtn.Text = "Toggle Farm" toggleBtn.Font = Enum.Font.Montserrat toggleBtn.TextColor3 = Color3.fromRGB(255,255,255) toggleBtn.BackgroundColor3 = Color3.fromRGB(70,70,70) toggleBtn.Parent = frame -- ===== Movable Frame Logic ===== local dragging = false local dragInput, mousePos, framePos topBar.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseButton1 then dragging = true mousePos = Vector2.new(player:GetMouse().X, player:GetMouse().Y) framePos = frame.Position input.Changed:Connect(function() if input.UserInputState == Enum.UserInputState.End then dragging = false end end) end end) topBar.InputChanged:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseMovement then dragInput = input end end) game:GetService("UserInputService").InputChanged:Connect(function(input) if dragging and input == dragInput then local delta = Vector2.new(player:GetMouse().X, player:GetMouse().Y) - mousePos frame.Position = UDim2.new(framePos.X.Scale, framePos.X.Offset + delta.X, framePos.Y.Scale, framePos.Y.Offset + delta.Y) end end) -- ===== Toggle Button Click ===== toggleBtn.MouseButton1Click:Connect(function() if running then stopMacro() else startMacro() end end)