OPEN SOURCE MACRO THING
Key RequiredUniversal

OPEN SOURCE MACRO THING

Universal ScriptHoneyWareHoneyWare 514 views 42 executesUpdated Feb 22, 2026
Unrated
00
Lua Script•322 lines (9954 chars)
-- Compact Autofarm GUI - Fixed Patterns + Walking + Convert

local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local VirtualInput = game:GetService("VirtualInputManager") or game:GetService("VirtualUser")

local plr = Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local root = char:WaitForChild("HumanoidRootPart")
local humanoid = char:WaitForChild("Humanoid")

-- GUI (compact)
local sg = Instance.new("ScreenGui")
sg.Name = "CompactFarm"
sg.ResetOnSpawn = false
sg.Parent = plr:WaitForChild("PlayerGui")

local frame = Instance.new("Frame")
frame.Size = UDim2.new(0, 280, 0, 260)
frame.Position = UDim2.new(0.5, -140, 0.5, -130)
frame.BackgroundColor3 = Color3.fromRGB(24, 24, 32)
frame.BorderSizePixel = 0
frame.Parent = sg

Instance.new("UICorner", frame).CornerRadius = UDim.new(0, 10)

local title = Instance.new("TextLabel")
title.Size = UDim2.new(1, 0, 0, 32)
title.BackgroundColor3 = Color3.fromRGB(34, 34, 44)
title.BorderSizePixel = 0
title.Text = "Farm + Conv"
title.TextColor3 = Color3.fromRGB(210, 220, 255)
title.Font = Enum.Font.GothamBold
title.TextSize = 15
title.Parent = frame

Instance.new("UICorner", title).CornerRadius = UDim.new(0, 10)

local status = Instance.new("TextLabel")
status.Size = UDim2.new(1, -16, 0, 20)
status.Position = UDim2.new(0, 8, 1, -28)
status.BackgroundTransparency = 1
status.Text = "Idle"
status.TextColor3 = Color3.fromRGB(160, 180, 220)
status.Font = Enum.Font.Gotham
status.TextSize = 12
status.TextXAlignment = Enum.TextXAlignment.Left
status.Parent = frame

local content = Instance.new("Frame")
content.Size = UDim2.new(1, -16, 1, -70)
content.Position = UDim2.new(0, 8, 0, 40)
content.BackgroundTransparency = 1
content.Parent = frame

local layout = Instance.new("UIListLayout")
layout.Padding = UDim.new(0, 6)
layout.SortOrder = Enum.SortOrder.LayoutOrder
layout.Parent = content

-- Toggle helper
local function Toggle(name, callback)
    local f = Instance.new("Frame")
    f.Size = UDim2.new(1, 0, 0, 32)
    f.BackgroundColor3 = Color3.fromRGB(32, 32, 42)
    f.BorderSizePixel = 0
    f.Parent = content

    Instance.new("UICorner", f).CornerRadius = UDim.new(0, 7)

    local lbl = Instance.new("TextLabel")
    lbl.Size = UDim2.new(0.7, 0, 1, 0)
    lbl.BackgroundTransparency = 1
    lbl.Text = name
    lbl.TextColor3 = Color3.fromRGB(225, 230, 245)
    lbl.Font = Enum.Font.GothamSemibold
    lbl.TextSize = 13
    lbl.TextXAlignment = Enum.TextXAlignment.Left
    lbl.Parent = f

    local tog = Instance.new("TextButton")
    tog.Size = UDim2.new(0, 48, 0, 24)
    tog.Position = UDim2.new(1, -56, 0.5, -12)
    tog.BackgroundColor3 = Color3.fromRGB(75, 75, 90)
    tog.Text = "OFF"
    tog.TextColor3 = Color3.new(1,1,1)
    tog.Font = Enum.Font.GothamBold
    tog.TextSize = 12
    tog.Parent = f

    Instance.new("UICorner", tog).CornerRadius = UDim.new(0, 12)

    local on = false
    tog.MouseButton1Click:Connect(function()
        on = not on
        tog.Text = on and "ON" or "OFF"
        tog.BackgroundColor3 = on and Color3.fromRGB(55, 190, 100) or Color3.fromRGB(75, 75, 90)
        callback(on)
        status.Text = name .. (on and " ON" or " OFF")
    end)

    return function() return on end
end

-- Dropdown
local function Dropdown(name, opts, def, callback)
    local f = Instance.new("Frame")
    f.Size = UDim2.new(1, 0, 0, 32)
    f.BackgroundColor3 = Color3.fromRGB(32, 32, 42)
    f.BorderSizePixel = 0
    f.Parent = content

    Instance.new("UICorner", f).CornerRadius = UDim.new(0, 7)

    local lbl = Instance.new("TextLabel")
    lbl.Size = UDim2.new(0.5, 0, 1, 0)
    lbl.BackgroundTransparency = 1
    lbl.Text = name
    lbl.TextColor3 = Color3.fromRGB(225, 230, 245)
    lbl.Font = Enum.Font.GothamSemibold
    lbl.TextSize = 13
    lbl.TextXAlignment = Enum.TextXAlignment.Left
    lbl.Parent = f

    local btn = Instance.new("TextButton")
    btn.Size = UDim2.new(0.48, 0, 0, 26)
    btn.Position = UDim2.new(0.52, 0, 0.5, -13)
    btn.BackgroundColor3 = Color3.fromRGB(45, 45, 58)
    btn.Text = def
    btn.TextColor3 = Color3.new(1,1,1)
    btn.Font = Enum.Font.Gotham
    btn.TextSize = 12
    btn.Parent = f

    Instance.new("UICorner", btn).CornerRadius = UDim.new(0, 7)

    local sel = def
    local i = 1
    btn.MouseButton1Click:Connect(function()
        i = (i % #opts) + 1
        sel = opts[i]
        btn.Text = sel
        callback(sel)
    end)

    return function() return sel end
end

-- Variables
local farmOn = false
local convOn = false
local hiveCFrame = nil
local anchorPos = nil
local pattern = "Circle"
local patternSpeed = 1.0
local patternTimer = 0
local nextRandomPos = nil

local patternOptions = {"Circle", "Square", "Zigzag", "Random"}
local patternSel = Dropdown("Pattern", patternOptions, "Circle", function(v) pattern = v end)

-- Speed cycle
local speedBtn = Instance.new("TextButton")
speedBtn.Size = UDim2.new(1, 0, 0, 32)
speedBtn.BackgroundColor3 = Color3.fromRGB(50, 90, 180)
speedBtn.BorderSizePixel = 0
speedBtn.Text = "Speed: Normal"
speedBtn.TextColor3 = Color3.new(1,1,1)
speedBtn.Font = Enum.Font.GothamSemibold
speedBtn.TextSize = 13
speedBtn.Parent = content

Instance.new("UICorner", speedBtn).CornerRadius = UDim.new(0, 7)

local speeds = {0.6, 1.0, 1.6}
local speedIdx = 2
speedBtn.MouseButton1Click:Connect(function()
    speedIdx = (speedIdx % #speeds) + 1
    patternSpeed = speeds[speedIdx]
    speedBtn.Text = "Speed: " .. (speedIdx==1 and "Slow" or speedIdx==2 and "Normal" or "Fast")
end)

-- Toggles
farmOn = Toggle("Autofarm", function(v)
    farmOn = v
    patternTimer = 0
    nextRandomPos = nil
    if v then
        anchorPos = root.Position
        status.Text = "Farm ON - " .. pattern
    else
        humanoid:Move(Vector3.new(), false)
        status.Text = "Farm OFF"
    end
end)

convOn = Toggle("Convert 5min", function(v)
    convOn = v
    status.Text = v and "Convert ON" or "Convert OFF"
end)

-- Set Hive
local hiveBtn = Instance.new("TextButton")
hiveBtn.Size = UDim2.new(1, 0, 0, 32)
hiveBtn.BackgroundColor3 = Color3.fromRGB(70, 130, 220)
hiveBtn.BorderSizePixel = 0
hiveBtn.Text = "Set Hive (stand here)"
hiveBtn.TextColor3 = Color3.new(1,1,1)
hiveBtn.Font = Enum.Font.GothamSemibold
hiveBtn.TextSize = 13
hiveBtn.Parent = content

Instance.new("UICorner", hiveBtn).CornerRadius = UDim.new(0, 7)

hiveBtn.MouseButton1Click:Connect(function()
    hiveCFrame = root.CFrame
    status.Text = "Hive saved"
end)

-- Close
local close = Instance.new("TextButton")
close.Size = UDim2.new(0, 28, 0, 28)
close.Position = UDim2.new(1, -34, 0, 2)
close.BackgroundColor3 = Color3.fromRGB(190, 60, 60)
close.BorderSizePixel = 0
close.Text = "X"
close.TextColor3 = Color3.new(1,1,1)
close.Font = Enum.Font.GothamBold
close.TextSize = 16
close.Parent = frame

Instance.new("UICorner", close).CornerRadius = UDim.new(0, 8)

close.MouseButton1Click:Connect(function() sg:Destroy() end)

-- Draggable
local drag, dragStart, startPos
title.InputBegan:Connect(function(inp)
    if inp.UserInputType == Enum.UserInputType.MouseButton1 then
        drag = true
        dragStart = inp.Position
        startPos = frame.Position
    end
end)

UserInputService.InputChanged:Connect(function(inp)
    if drag and inp.UserInputType == Enum.UserInputType.MouseMovement then
        local delta = inp.Position - dragStart
        frame.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
    end
end)

title.InputEnded:Connect(function(inp)
    if inp.UserInputType == Enum.UserInputType.MouseButton1 then drag = false end
end)

-- Main loop
local lastConv = tick()

RunService.Heartbeat:Connect(function(dt)
    if not root or not humanoid then return end

    patternTimer = patternTimer + dt * patternSpeed

    -- Convert
    if convOn and hiveCFrame and tick() - lastConv > 300 then
        lastConv = tick()
        local returnPos = root.Position

        root.CFrame = hiveCFrame + Vector3.new(0, 3, 0)
        task.wait(3)

        pcall(function()
            VirtualInput:SendKeyEvent(true, Enum.KeyCode.E, false, game)
            task.wait(0.08)
            VirtualInput:SendKeyEvent(false, Enum.KeyCode.E, false, game)
        end)

        task.wait(60)
        root.CFrame = CFrame.new(returnPos)
        status.Text = "Returned after convert"
    end

    -- Autofarm - walking
    if farmOn and anchorPos then
        local center = anchorPos
        local targetPos

        if pattern == "Circle" then
            local angle = patternTimer * 1.2
            targetPos = center + Vector3.new(math.cos(angle) * 22, 0, math.sin(angle) * 22)
        elseif pattern == "Square" then
            local t = patternTimer % 8
            if t < 2 then targetPos = center + Vector3.new(24, 0, 24 - t*24)
            elseif t < 4 then targetPos = center + Vector3.new(24 - (t-2)*24, 0, -24)
            elseif t < 6 then targetPos = center + Vector3.new(-24, 0, -24 + (t-4)*24)
            else targetPos = center + Vector3.new(-24 + (t-6)*24, 0, 24)
            end
        elseif pattern == "Zigzag" then
            targetPos = center + Vector3.new(math.sin(patternTimer*2.8)*30, 0, math.cos(patternTimer*1.1)*15)
        elseif pattern == "Random" then
            -- Stay inside 20×20 square
            if not nextRandomPos or (root.Position - nextRandomPos).Magnitude < 3 then
                nextRandomPos = center + Vector3.new(
                    math.random(-10, 10),
                    0,
                    math.random(-10, 10)
                )
            end
            targetPos = nextRandomPos
        end

        if targetPos then
            humanoid:MoveTo(targetPos + Vector3.new(0, 3, 0))  -- slight height offset
        end
    else
        humanoid:Move(Vector3.new(), false)
    end
end)

status.Text = "Ready – set hive first if using convert"

Features & Information

This is made with ai but its pretty useful. i made it for me originally but decided to post it
#OpenSource#Universal

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts