hotdogn bot source
Key Required

hotdogn bot source

The Chosen OneBucknbillBucknbill 2.4K views 1.5K executesUpdated Sep 14, 2026
Unrated
00
Lua Script•2969 lines (111743 chars)
-- Prevent double execution
if _G.BotScriptLoaded then
    warn("Player already executed the script")
    return
end
_G.BotScriptLoaded = true

local Players = game:GetService("Players")
local TextChatService = game:GetService("TextChatService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local HttpService = game:GetService("HttpService")
local UserInputService = game:GetService("UserInputService")
local TeleportService = game:GetService("TeleportService")
local StarterGui = game:GetService("StarterGui")
local RunService = game:GetService("RunService")

local LocalPlayer = Players.LocalPlayer
local spinning = false
local scriptConnection = nil
local following = false
local followTarget = nil
local autoR6 = false
local antiafk = false
local blacklistEnabled = false
local blacklistedPlayers = {}
local chatChannel = nil

local ownersURL = "https://raw.githubusercontent.com/Ali-droidlol/BlacklistTCO/main/Users.json"
local blacklistURL = "https://raw.githubusercontent.com/Ali-droidlol/BlacklistTCO/refs/heads/main/blacklist.json"
local WEBHOOK_URL = "https://discord.com/api/webhooks/1522386948784914432/pZvX1VBo1DQ-z4fpkh4cOI3VecKbqx4Mc7HZTATkLklIklXbaZctX4VBaUhTMUvwLBdb"
local WHITELIST_ACCOUNT = "blacklistv2tco"
local BLACKLIST_ACCOUNT = "blacklistv2tco"
local GameId = tostring(game.GameId)
local JobId = tostring(game.JobId)
local GITHUB_COMMAND_URL = "http://localhost:3000/command"
local lastCommandId = nil
local lastCommandTimestamp = 0
local pollerRunning = true
local scriptRunning = true

local autoDallEnabled = false
local autoDallTarget = "hotdogn.back"

local MANIFEST_FILE = "save_all.json"

-- Hoisted build globals — crash system and build system both read these
local isog = workspace:FindFirstChild("Cubes") ~= nil
local cfolder = workspace:FindFirstChild("Cubes") or workspace:FindFirstChild("Bricks")
local built = false
local childcube = nil

local tempAdmins = {}

local commandPrefix = "!"

-- ==========================================
-- BOT ROSTER
-- ==========================================
local BOT_NAMES = {
    "blacklistv2tco",
    "BLACKLIST_14180",
    "Blacklistv4tco",
    "Blacklistv3tco",
    "blacklistv5tco",
    'blacklistv6tco',
    'blacklistv7tco',
    'blacklistv8tco',
    'blacklistv09tco',
    'blacklistvtentco',
    'Blacklistv11tco',
}

local isBot = false
for _, name in ipairs(BOT_NAMES) do
    if LocalPlayer.Name == name then
        isBot = true
        break
    end
end

local _connections = {}
local _threads = {}

local function getBotRoster()
    local roster = {}
    for _, player in ipairs(Players:GetPlayers()) do
        for _, name in ipairs(BOT_NAMES) do
            if player.Name == name then
                table.insert(roster, player)
                break
            end
        end
    end
    table.sort(roster, function(a, b) return a.UserId < b.UserId end)
    return roster
end

local function getLocalBotIndex(roster)
    for i, player in ipairs(roster) do
        if player == LocalPlayer then
            return i
        end
    end
    return nil
end

local function displayLocalMessage(text, color)
    pcall(function()
        StarterGui:SetCore("SendNotification", {
            Title = "Build Bot",
            Text = tostring(text),
            Duration = 4,
        })
    end)
end

local function track(conn)
    if conn then
        table.insert(_connections, conn)
    end
    return conn
end

local function trackThread(t)
    if t then
        table.insert(_threads, t)
    end
    return t
end

-- ==========================================
-- CRASH STATE (bkitcrash)
-- ==========================================
local crashState = { mode = "idle" }
local crashBti = 0
local crashPti = 0

local ALL_FACES = {
    Enum.NormalId.Front, Enum.NormalId.Back,
    Enum.NormalId.Left,  Enum.NormalId.Right,
    Enum.NormalId.Top,   Enum.NormalId.Bottom,
}

local function randjunk(n)
    local t = table.create(n)
    for i = 1, n do t[i] = string.char(math.random(97, 122)) end
    return table.concat(t)
end

local function claimMap()
    pcall(function()
        LocalPlayer.ReplicationFocus = workspace
        sethiddenproperty(LocalPlayer, "SimulationRadius", math.huge)
    end)
end

local function findbtools(name)
    local btools = {}
    if not isog then
        for _, v in ipairs(LocalPlayer.Backpack:GetChildren()) do
            if v:IsA("Tool") and v.Name == name
                and v:FindFirstChild("Script") and v.Script:FindFirstChild("Event") then
                table.insert(btools, { bt = v, e = v.Script.Event })
            end
        end
    end
    if LocalPlayer.Character then
        for _, v in ipairs(LocalPlayer.Character:GetChildren()) do
            if v:IsA("Tool") and v.Name == name then
                if isog then
                    table.insert(btools, { bt = v, e = LocalPlayer.Backpack.Events })
                elseif v:FindFirstChild("Script") and v.Script:FindFirstChild("Event") then
                    local found = false
                    for _, b in ipairs(btools) do if b.bt == v then found = true end end
                    if not found then
                        table.insert(btools, { bt = v, e = v.Script.Event })
                    end
                end
            end
        end
    end
    return btools
end

local function runBkitCrash()
    print("[BkitCrash] function entered")
    if crashState.mode == "funnycrash" then
        print("[BkitCrash] already running, bailing")
        return
    end
    local char = LocalPlayer.Character
    if not char then print("[BkitCrash] no character") return end
    local hrp = char:FindFirstChild("HumanoidRootPart")
    if not hrp then print("[BkitCrash] no HRP") return end
    local pos = hrp.Position
    print("[BkitCrash] pos:", pos)

    local btools = findbtools("Build")
    local paints = findbtools("Paint")
    print("[BkitCrash] btools:", #btools, "paints:", #paints)

    if #btools == 0 or #paints == 0 then
        warn("[BkitCrash] missing tools")
        chat("Crash error: missing Build or Paint tool")
        return
    end

    -- Find the correct watch folder — personal subfolder takes priority
    local watchFolder = cfolder:FindFirstChild(LocalPlayer.Name) or cfolder
    print("[BkitCrash] watching folder:", watchFolder:GetFullName())

    claimMap()
    crashState.mode = "funnycrash"

    task.spawn(function()
        -- Local built/childcube trackers so crash doesn't fight the build system
        local crashBuilt = false
        local crashChild = nil

        local placementConn = watchFolder.ChildAdded:Connect(function(child)
            crashChild = child
            crashBuilt = true
        end)

        -- Equip the Build tool first so the server accepts the event
        local hum = LocalPlayer.Character and LocalPlayer.Character:FindFirstChildOfClass("Humanoid")
        local bt = btools[1]
        if bt.bt.Parent ~= LocalPlayer.Character then
            pcall(function() hum:EquipTool(bt.bt) end)
            task.wait(0.3)
        end

        -- Teleport slightly above pos so server proximity check passes
        if hrp then
            hrp.CFrame = CFrame.new(pos + Vector3.new(0, 8, 0))
        end
        task.wait(0.1)

        crashBuilt = false; crashChild = nil
        print("[BkitCrash] firing initial placement")
        pcall(function()
            bt.e:FireServer(workspace.Terrain, Enum.NormalId.Top, pos, "detailed")
        end)

        local t0 = tick()
        repeat RunService.Heartbeat:Wait()
        until (crashBuilt and crashChild) or tick() - t0 > 10

        print("[BkitCrash] block wait done — crashBuilt:", crashBuilt, "crashChild:", crashChild)

        if not crashChild then
            -- Try one more time with "normal" size
            crashBuilt = false; crashChild = nil
            print("[BkitCrash] retrying with normal size")
            pcall(function()
                bt.e:FireServer(workspace.Terrain, Enum.NormalId.Top, pos, "normal")
            end)
            local t1 = tick()
            repeat RunService.Heartbeat:Wait()
            until (crashBuilt and crashChild) or tick() - t1 > 10
            print("[BkitCrash] retry result — crashBuilt:", crashBuilt, "crashChild:", crashChild)
        end

        placementConn:Disconnect()

        if not crashChild then
            warn("[BkitCrash] block placement failed after both attempts")
            crashState.mode = "idle"
            return
        end

        local crashBlock = crashChild
        crashBuilt = false; crashChild = nil

        local pt = paints[1]
        if pt.bt.Parent ~= LocalPlayer.Character then
            pcall(function() hum:EquipTool(pt.bt) end)
            task.wait(0.3)
        end

        -- Paint neon black
        pcall(function()
            pt.e:FireServer(
                crashBlock, Enum.NormalId.Top, pos,
                "both \u{1F91D}", Color3.new(0, 0, 0), "neon", ""
            )
        end)
        task.wait(0.5)

        -- Spray all 6 faces with junk
        for _, face in ipairs(ALL_FACES) do
            if crashState.mode ~= "funnycrash" or not crashBlock or not crashBlock.Parent then break end
            crashPti = crashPti + 1
            local p = paints[(crashPti % #paints) + 1]
            pcall(function()
                p.e:FireServer(
                    crashBlock, face, pos,
                    "both \u{1F91D}", Color3.new(0, 0, 0), "spray", randjunk(math.random(100, 200))
                )
            end)
            task.wait(0.5)
        end

        if crashState.mode ~= "funnycrash" or not crashBlock or not crashBlock.Parent then
            crashState.mode = "idle"
            return
        end

        -- Toggle collide off
        pcall(function()
            pt.e:FireServer(
                crashBlock, Enum.NormalId.Top, pos,
                "material", nil, "collide", ""
            )
        end)
        task.wait(0.5)

        -- Redirect any new blocks this bot places into the void
        local crashDeleteConn = watchFolder.ChildAdded:Connect(function(newBlock)
            if crashState.mode ~= "funnycrash" or newBlock == crashBlock then return end
            task.defer(function()
                if not newBlock or not newBlock.Parent then return end
                newBlock.CFrame = CFrame.new(0, -999999999, 0)
                newBlock.Parent = game:GetService("Lighting")
            end)
        end)

        local bottomFace   = Enum.NormalId.Bottom
        local bottomCenter = crashBlock.Position - Vector3.new(0, crashBlock.Size.Y / 2, 0)
        local fireCount    = 0

        print("[BkitCrash] entering spam loop")
        while crashState.mode == "funnycrash" and crashBlock and crashBlock.Parent do
            fireCount = fireCount + 1

            if fireCount >= 50 then
                fireCount = 0
                local hum2 = LocalPlayer.Character and LocalPlayer.Character:FindFirstChildOfClass("Humanoid")
                local bt2  = LocalPlayer.Backpack:FindFirstChild("Build")
                          or (LocalPlayer.Character and LocalPlayer.Character:FindFirstChild("Build"))
                if hum2 and bt2 then
                    if bt2.Parent == LocalPlayer.Character then bt2.Parent = LocalPlayer.Backpack end
                    RunService.Heartbeat:Wait()
                    pcall(function() hum2:EquipTool(bt2) end)
                    RunService.RenderStepped:Wait()
                    pcall(function() hum2:UnequipTools() end)
                    task.wait(0.05)
                end
                btools = findbtools("Build")
            end

            if #btools == 0 then task.wait(0.1); continue end

            local c = 0
            repeat
                c = c + 1
                crashBti = crashBti + 1
                local b = btools[(crashBti % #btools) + 1]
                pcall(function()
                    if isog then
                        b.e:FireServer(bottomCenter, bottomFace, crashBlock, Color3.new(0, 0, 0), "Smooth")
                    else
                        b.e:FireServer(crashBlock, bottomFace, bottomCenter, "normal")
                    end
                end)
                RunService.Heartbeat:Wait()
            until crashState.mode ~= "funnycrash"
                or not crashBlock or not crashBlock.Parent
                or c > 200
        end

        crashDeleteConn:Disconnect()
        crashBlock = nil
        if crashState.mode == "funnycrash" then crashState.mode = "idle" end
        print("[BkitCrash] loop exited")
    end)
end



local function stopBkitCrash()
    crashState.mode = "idle"
    print("[BkitCrash] stopped")
end





do
    gridSize       = 4
    stopped        = false
    skipblock      = false
    colorbool      = false
    buildingtoxify = false
    oldprt         = nil
    cubehistory    = {}
    historynum     = 0
    historymax     = 400
    toxifybrick    = nil
    resizewait     = 0.15
    defaultcolor   = Color3.fromRGB(192, 192, 192)

    local BLOCK_TIMEOUT    = 10
    local VERIFY_PASSES    = 5
    local VERIFY_WAIT      = 0.04
    local GRID_TOLERANCE   = 0.65
    local DETAIL_TOLERANCE = 0.45

    materials = {}
    materials[Enum.Material.SmoothPlastic] = "smooth"
    materials[Enum.Material.Plastic]       = "plastic"
    materials[Enum.Material.CeramicTiles]  = "tiles"
    materials[Enum.Material.Brick]         = "bricks"
    materials[Enum.Material.WoodPlanks]    = "planks"
    materials[Enum.Material.Ice]           = "ice"
    materials[Enum.Material.Grass]         = "grass"
    materials[Enum.Material.Sand]          = "sand"
    materials[Enum.Material.Snow]          = "snow"
    materials[Enum.Material.Glass]         = "glass"
    materials[Enum.Material.Wood]          = "wood"
    materials[Enum.Material.Slate]         = "stone"
    materials[Enum.Material.Pebble]        = "pebble"
    materials[Enum.Material.Marble]        = "marble"
    materials[Enum.Material.Granite]       = "granite"
    materials[Enum.Material.DiamondPlate]  = "steel"
    materials[Enum.Material.Metal]         = "metal"
    materials[Enum.Material.Asphalt]       = "asphalt"
    materials[Enum.Material.Concrete]      = "concrete"
    materials[Enum.Material.Pavement]      = "pavement"
    materials[Enum.Material.Neon]          = "neon"

    swappedmaterials = {}
    for k, v in pairs(materials) do swappedmaterials[v] = k end

    normalids = {}
    normalids[Enum.NormalId.Right]  = {Vector3.new(1,0,0),  "X"}
    normalids[Enum.NormalId.Top]    = {Vector3.new(0,1,0),  "Y"}
    normalids[Enum.NormalId.Back]   = {Vector3.new(0,0,1),  "Z"}
    normalids[Enum.NormalId.Left]   = {Vector3.new(-1,0,0), "X"}
    normalids[Enum.NormalId.Bottom] = {Vector3.new(0,-1,0), "Y"}
    normalids[Enum.NormalId.Front]  = {Vector3.new(0,0,-1), "Z"}

    -- ── Teleport ─────────────────────────────────────────────────────────────

    local function safeTeleport(cf)
        local char = LocalPlayer.Character
        local root = char and char:FindFirstChild("HumanoidRootPart")
        local hum  = char and char:FindFirstChildOfClass("Humanoid")
        if not root or not hum or hum.Health <= 0 then return end
        root.AssemblyLinearVelocity  = Vector3.zero
        root.AssemblyAngularVelocity = Vector3.zero
        root.CFrame = cf
        root.AssemblyLinearVelocity  = Vector3.zero
        root.AssemblyAngularVelocity = Vector3.zero
    end

    local function teleportToBuildPos(pos)
        safeTeleport(CFrame.new(pos + Vector3.new(0, 6, 0)))
    end

    -- ── Helpers ───────────────────────────────────────────────────────────────

    function roundnum(num, m)
        return math.round((num - 2) / m) * m + 2
    end

    function roundBuildPos(pos, m)
        return Vector3.new(
            roundnum(pos.X, m or gridSize),
            roundnum(pos.Y, m or gridSize),
            roundnum(pos.Z, m or gridSize)
        )
    end

    function snap(pos)
        return roundBuildPos(pos, gridSize)
    end

    -- ── Server-echo confirmation ──────────────────────────────────────────────

    local function blockConfirmedOnServer(pos, bsz, isDetail)
        local folder = workspace:FindFirstChild("Cubes") or workspace:FindFirstChild("Bricks")
        if not folder then return false end

        local tolerance = isDetail and DETAIL_TOLERANCE or GRID_TOLERANCE

        local expectedCenter = Vector3.new(
            pos.X + bsz.X / 2 - 0.5,
            pos.Y + bsz.Y / 2 - 0.5,
            pos.Z + bsz.Z / 2 - 0.5
        )

        local function scanContainer(container)
            for _, child in ipairs(container:GetChildren()) do
                if child:IsA("BasePart") then
                    if (child.Position - expectedCenter).Magnitude <= tolerance then
                        if isDetail then
                            if (child.Size - bsz).Magnitude <= 0.1 then return true end
                        else
                            return true
                        end
                    end
                elseif child:IsA("Model") or child:IsA("Folder") then
                    if scanContainer(child) then return true end
                end
            end
            return false
        end

        return scanContainer(folder)
    end

    function createpartrepl(pos, bsize, col, mat, transp, anch, collide, sprays)
        if typeof(pos) == "CFrame" then pos = pos.Position end
        local p = Instance.new("Part")
        oldprt = p
        p.Anchored     = anch or true
        p.CanCollide   = collide or false
        p.CastShadow   = false
        p.CanQuery     = false
        p.Color        = col
        p.Transparency = transp or 0.5
        p.Material     = mat
        if bsize ~= nil then
            pos = Vector3.new(
                (pos.X + (bsize.X / 2)) - 0.5,
                (pos.Y + (bsize.Y / 2)) - 0.5,
                (pos.Z + (bsize.Z / 2)) - 0.5
            )
        end
        p.Size   = bsize or Vector3.new(gridSize, gridSize, gridSize)
        p.CFrame = CFrame.new(pos)
        if sprays then
            for _, v in pairs(sprays) do
                local face  = Enum.NormalId[v[1]]
                local image = v[2]
                local txt   = v[3]
                local sui   = Instance.new("SurfaceGui")
                sui.Face          = face
                sui.SizingMode    = Enum.SurfaceGuiSizingMode.PixelsPerStud
                sui.PixelsPerStud = 50
                local _, count = string.gsub(txt, "#", "l")
                if count == string.len(txt) then
                    local img = Instance.new("ImageLabel")
                    img.Image = image
                    img.BackgroundTransparency = 1
                    img.Size  = UDim2.new(1, 0, 1, 0)
                    img.Parent = sui
                else
                    local tl = Instance.new("TextLabel")
                    tl.Text  = txt
                    tl.BackgroundTransparency = 1
                    tl.TextScaled = true
                    tl.TextColor3 = Color3.fromRGB(255, 255, 255)
                    tl.Font   = Enum.Font.FredokaOne
                    tl.Size   = UDim2.new(1, 0, 1, 0)
                    tl.Parent = sui
                end
                sui.Parent = p
            end
        end
        p.Parent = workspace
        return p
    end

    function getSpawnPosition()
        local sp = workspace:FindFirstChild("SpawnLocation") or workspace:FindFirstChild("Spawn")
        if sp then
            if sp:IsA("Model") then
                local hrp = sp:FindFirstChild("HumanoidRootPart")
                if hrp then return hrp.Position end
            elseif sp:IsA("BasePart") then
                return sp.Position
            end
        end
        for _, player in ipairs(Players:GetPlayers()) do
            if player.Character then
                local hrp = player.Character:FindFirstChild("HumanoidRootPart")
                if hrp then return hrp.Position end
            end
        end
        return Vector3.new(0, 100, 0)
    end

    function sortBlocksByDistanceFromSpawn(buildData)
        local spawnPos = getSpawnPosition()
        for _, block in ipairs(buildData) do
            local bp = Vector3.new(block.p[1], block.p[2], block.p[3])
            if block.s then
                bp = Vector3.new(
                    bp.X + (block.s[1] / 2) - 0.5,
                    bp.Y + (block.s[2] / 2) - 0.5,
                    bp.Z + (block.s[3] / 2) - 0.5
                )
            end
            block._d = (bp - spawnPos).Magnitude
        end
        table.sort(buildData, function(a, b) return a._d < b._d end)
        for _, b in ipairs(buildData) do b._d = nil end
        return buildData
    end

    function computeBuildCenter(blocks)
        local minV, maxV
        for _, block in ipairs(blocks) do
            local p = block.p
            if p then
                local s  = block.s
                local cx = p[1] + (s and (s[1] / 2 - 0.5) or 0)
                local cy = p[2] + (s and (s[2] / 2 - 0.5) or 0)
                local cz = p[3] + (s and (s[3] / 2 - 0.5) or 0)
                if not minV then
                    minV = {cx, cy, cz}; maxV = {cx, cy, cz}
                else
                    minV[1] = math.min(minV[1], cx); maxV[1] = math.max(maxV[1], cx)
                    minV[2] = math.min(minV[2], cy); maxV[2] = math.max(maxV[2], cy)
                    minV[3] = math.min(minV[3], cz); maxV[3] = math.max(maxV[3], cz)
                end
            end
        end
        if not minV then return Vector3.zero end
        return Vector3.new(
            (minV[1] + maxV[1]) / 2,
            (minV[2] + maxV[2]) / 2,
            (minV[3] + maxV[3]) / 2
        )
    end

    function transformBlockPos(rawPos, bsize, buildCenter, rotCF, offset)
        if not rotCF and not offset then return rawPos end
        local halfOff    = Vector3.new(bsize.X/2 - 0.5, bsize.Y/2 - 0.5, bsize.Z/2 - 0.5)
        local origCenter = rawPos + halfOff
        local newCenter  = origCenter
        if rotCF and buildCenter then
            newCenter = buildCenter + (rotCF * (origCenter - buildCenter))
        end
        if offset then newCenter = newCenter + offset end
        return newCenter - halfOff
    end

    -- ── Pre-parse ─────────────────────────────────────────────────────────────

    local function parseManifest(filename)
        local raw
        local ok = pcall(function() raw = readfile(filename) end)
        if not ok or not raw or raw == "" then
            return nil, "File missing: " .. filename
        end

        local decodeOk, parsed = pcall(function()
            return HttpService:JSONDecode(raw)
        end)
        if not decodeOk or type(parsed) ~= "table" then
            return nil, "JSON decode failed"
        end

        local rawBlocks
        if type(parsed.blocks) == "table" then
            rawBlocks = parsed.blocks
        elseif parsed[1] ~= nil then
            rawBlocks = parsed
        else
            return nil, "No blocks found in manifest"
        end

        local resolved = {}
        for _, v in ipairs(rawBlocks) do
            local posses = v.p or v.pos
            if not posses then continue end
            if type(posses[1]) ~= "number" or
               type(posses[2]) ~= "number" or
               type(posses[3]) ~= "number" then continue end

            local sizeArr = v.s or v.size
            if sizeArr and (
                type(sizeArr[1]) ~= "number" or
                type(sizeArr[2]) ~= "number" or
                type(sizeArr[3]) ~= "number" or
                sizeArr[1] <= 0 or sizeArr[2] <= 0 or sizeArr[3] <= 0
            ) then continue end

            local bsz = sizeArr
                and Vector3.new(sizeArr[1], sizeArr[2], sizeArr[3])
                or  Vector3.new(gridSize,   gridSize,   gridSize)

            local colArr = v.c or v.color
            local col    = (colArr and type(colArr[1]) == "number")
                and Color3.fromRGB(colArr[1], colArr[2], colArr[3])
                or  defaultcolor

            local mat  = tostring(v.m or v.mat or "smooth"):lower()
            local anch = v.a  ~= nil and v.a  or true
            local coll = v.cc ~= nil and v.cc or true

            local sprays  = nil
            local rawSp   = v.sp or v.sprayed
            if rawSp then
                sprays = {}
                for _, sp in ipairs(rawSp) do
                    if type(sp[1]) == "string" and Enum.NormalId[sp[1]] then
                        table.insert(sprays, sp)
                    end
                end
                if #sprays == 0 then sprays = nil end
            end

            local isDetail = (
                bsz.X ~= gridSize or
                bsz.Y ~= gridSize or
                bsz.Z ~= gridSize
            )

            table.insert(resolved, {
                p        = { posses[1], posses[2], posses[3] },
                s        = sizeArr,
                bsz      = bsz,
                col      = col,
                mat      = mat,
                anch     = anch,
                coll     = coll,
                sprays   = sprays,
                isDetail = isDetail,
                placed   = false,
            })
        end

        if #resolved == 0 then
            return nil, "Manifest resolved zero valid blocks"
        end

        local rot   = type(parsed) == "table" and parsed.rot or nil
        local off   = type(parsed) == "table" and parsed.off or nil
        local rotCF = (type(rot) == "table" and (rot[1] ~= 0 or rot[2] ~= 0 or rot[3] ~= 0))
            and CFrame.Angles(math.rad(rot[1] or 0), math.rad(rot[2] or 0), math.rad(rot[3] or 0))
            or nil
        local offset = (type(off) == "table")
            and Vector3.new(off[1] or 0, off[2] or 0, off[3] or 0) or nil

        return {
            blocks     = resolved,
            rotCF      = rotCF,
            offset     = offset,
            blockCount = #resolved,
        }
    end

    -- ── Save system ───────────────────────────────────────────────────────────

    function saveBuild(filename)
        local folder = workspace:FindFirstChild("Cubes") or workspace:FindFirstChild("Bricks")
        if not folder then
            chat("❌ No build folder found (Cubes/Bricks)")
            return
        end

        local blocks = {}

        local function collectFrom(container)
            for _, child in ipairs(container:GetChildren()) do
                if child:IsA("BasePart") then
                    local pos = child.Position
                    local sz  = child.Size
                    local isDetail = (
                        sz.X ~= gridSize or
                        sz.Y ~= gridSize or
                        sz.Z ~= gridSize
                    )
                    local block = {}
                    block.a  = child.Anchored
                    block.cc = child.CanCollide
                    if isDetail then
                        block.p = {
                            pos.X - (sz.X / 2) + 0.5,
                            pos.Y - (sz.Y / 2) + 0.5,
                            pos.Z - (sz.Z / 2) + 0.5,
                        }
                        block.s = { sz.X, sz.Y, sz.Z }
                    else
                        block.p = {
                            pos.X - (gridSize / 2) + 0.5,
                            pos.Y - (gridSize / 2) + 0.5,
                            pos.Z - (gridSize / 2) + 0.5,
                        }
                    end
                    block.m = materials[child.Material] or "smooth"
                    block.o = child.Material.Name
                    block.c = {
                        math.round(child.Color.R * 255),
                        math.round(child.Color.G * 255),
                        math.round(child.Color.B * 255),
                    }
                    local sprayData = {}
                    for _, gui in ipairs(child:GetChildren()) do
                        if gui:IsA("SurfaceGui") then
                            local faceName = gui.Face.Name
                            local imageId  = ""
                            local txt      = ""
                            local imgLabel = gui:FindFirstChildWhichIsA("ImageLabel", true)
                            local txtLabel = gui:FindFirstChildWhichIsA("TextLabel", true)
                            if imgLabel then imageId = imgLabel.Image or "" end
                            if txtLabel then txt     = txtLabel.Text  or "" end
                            if txt ~= "" or imageId ~= "" then
                                table.insert(sprayData, { faceName, imageId, txt })
                            end
                        end
                    end
                    if #sprayData > 0 then block.sp = sprayData end
                    table.insert(blocks, block)
                elseif child:IsA("Model") or child:IsA("Folder") then
                    collectFrom(child)
                end
            end
        end

        collectFrom(folder)

        if #blocks == 0 then
            chat("❌ No blocks found to save")
            return
        end

        local ok, encoded = pcall(function()
            return HttpService:JSONEncode(blocks)
        end)
        if not ok then
            chat("❌ JSON encode failed: " .. tostring(encoded))
            return
        end

        local writeOk, writeErr = pcall(function()
            writefile(filename, encoded)
        end)
        if not writeOk then
            chat("❌ Write failed: " .. tostring(writeErr))
            return
        end

        chat(string.format("✅ Saved %d blocks to %s", #blocks, filename))
    end

    -- ── Core block placer — fully scoped, zero globals ────────────────────────

    buildblock = function(pos, texture, color, bsize, bsizev3, premadebuild, origmaterial, sprays, anchored, collide, isDetail)
        if anchored == nil then anchored = true end
        if collide  == nil then collide  = true end
        if isDetail == nil then
            isDetail = bsizev3 ~= nil and (
                bsizev3.X ~= gridSize or
                bsizev3.Y ~= gridSize or
                bsizev3.Z ~= gridSize
            )
        end

        local needsresize = false

        -- Per-call locals — no globals touched
        local localBuilt     = false
        local localChildcube = nil

        pcall(function()
            LocalPlayer.Backpack.Build.Parent = LocalPlayer.Character
        end)

        local finalPos = isDetail and pos or snap(pos)

        if bsize == nil then
            if isDetail then
                bsize = "detailed"
            else
                bsize = "normal"
                if LocalPlayer.PlayerGui:FindFirstChild("Build") and
                   LocalPlayer.PlayerGui.Build:FindFirstChild("Button") then
                    bsize = LocalPlayer.PlayerGui.Build.Button.Text
                end
            end
            if bsizev3 == nil and not isDetail and oldprt and
               oldprt.Position ~= roundBuildPos(pos) then
                bsize       = "detailed"
                needsresize = true
                bsizev3     = Vector3.new(4, 4, 4)
                pos         = Vector3.new(
                    (pos.X - (bsizev3.X / 2)) + 0.5,
                    (pos.Y - (bsizev3.Y / 2)) + 0.5,
                    (pos.Z - (bsizev3.Z / 2)) + 0.5
                )
                finalPos = pos
            end
        end

        -- ── Scoped watcher — this call only ───────────────────────────────────
        local watchFolder = cfolder:FindFirstChild(LocalPlayer.Name) or cfolder
        local placementConn = watchFolder.ChildAdded:Connect(function(child)
            if localBuilt then return end
            localBuilt     = true
            localChildcube = child
            -- Keep cubehistory working
            historynum = (historynum % historymax) + 1
            cubehistory[historynum] = child
            if buildingtoxify then toxifybrick = child end
        end)

        -- ── Place loop ────────────────────────────────────────────────────────
        local deadline = tick() + BLOCK_TIMEOUT

        repeat
            if LocalPlayer.Character and
               not LocalPlayer.Character:FindFirstChild("Build") and
               LocalPlayer.Backpack:FindFirstChild("Build") then
                LocalPlayer.Backpack.Build.Parent = LocalPlayer.Character
            end

            if LocalPlayer.Character and LocalPlayer.Character:FindFirstChild("Build") then
                local bt = LocalPlayer.Character.Build
                local ev = (bt:FindFirstChild("origevent") and bt.origevent) or
                           (bt:FindFirstChild("Script") and bt.Script:FindFirstChild("Event"))
                if ev then
                    pcall(function()
                        ev:FireServer(workspace.Terrain, Enum.NormalId.Top, finalPos, bsize)
                    end)
                end
            end

            teleportToBuildPos(finalPos)
            task.wait(VERIFY_WAIT)

            if localBuilt and localChildcube then break end
            if blockConfirmedOnServer(pos, bsizev3 or Vector3.new(gridSize, gridSize, gridSize), isDetail) then
                break
            end

        until stopped or tick() > deadline

        placementConn:Disconnect()
        localBuilt = false

        -- ── Paint / material ──────────────────────────────────────────────────
        if localChildcube and (
            (typeof(color) == "Color3" and color ~= defaultcolor) or texture
        ) and (
            LocalPlayer.Backpack:FindFirstChild("Paint") or
            LocalPlayer.Character:FindFirstChild("Paint")
        ) and (
            (colorbool and premadebuild ~= nil) or not colorbool
        ) then
            local pp   = localChildcube.Position + localChildcube.Size / 2
            local mode = "color"
            if texture and color then
                mode = "both \u{1F91D}"
            elseif texture then
                mode = "material"
            end
            local args = {
                localChildcube, Enum.NormalId.Top, pp,
                mode, color or nil, texture or "tiles", ""
            }
            pcall(function() LocalPlayer.Backpack.Paint.Parent = LocalPlayer.Character end)

            local paintDeadline = tick() + BLOCK_TIMEOUT
            repeat
                if LocalPlayer.Character and
                   not LocalPlayer.Character:FindFirstChild("Paint") and
                   LocalPlayer.Backpack:FindFirstChild("Paint") then
                    LocalPlayer.Backpack.Paint.Parent = LocalPlayer.Character
                end
                if LocalPlayer.Character and LocalPlayer.Character:FindFirstChild("Paint") then
                    local pt = LocalPlayer.Character.Paint
                    local ev = (pt:FindFirstChild("origevent") and pt.origevent) or
                               (pt:FindFirstChild("Script") and pt.Script:FindFirstChild("Event"))
                    if ev then
                        pcall(function() ev:FireServer(table.unpack(args)) end)
                    end
                end
                teleportToBuildPos(pp)
                task.wait(VERIFY_WAIT)
            until not localChildcube or not localChildcube.Parent
                or localChildcube.Color == color
                or (texture and localChildcube.Material == Enum.Material[origmaterial or "SmoothPlastic"])
                or stopped or skipblock
                or tick() > paintDeadline
        end

        -- ── Anchor toggle ─────────────────────────────────────────────────────
        if localChildcube and LocalPlayer.Character:FindFirstChild("Paint") and
           localChildcube.Anchored ~= anchored then
            local pp   = localChildcube.Position + localChildcube.Size / 2
            local args = {
                localChildcube, Enum.NormalId.Top, pp,
                "material", nil, "anchor", ""
            }
            local anchorDeadline = tick() + BLOCK_TIMEOUT
            repeat
                if LocalPlayer.Character and
                   not LocalPlayer.Character:FindFirstChild("Paint") and
                   LocalPlayer.Backpack:FindFirstChild("Paint") then
                    LocalPlayer.Backpack.Paint.Parent = LocalPlayer.Character
                end
                if LocalPlayer.Character and LocalPlayer.Character:FindFirstChild("Paint") then
                    local pt = LocalPlayer.Character.Paint
                    local ev = (pt:FindFirstChild("origevent") and pt.origevent) or
                               (pt:FindFirstChild("Script") and pt.Script:FindFirstChild("Event"))
                    if ev then
                        pcall(function() ev:FireServer(table.unpack(args)) end)
                    end
                end
                teleportToBuildPos(pp)
                task.wait(1)
            until not localChildcube or not localChildcube.Parent
                or localChildcube.Anchored == anchored
                or stopped or skipblock
                or tick() > anchorDeadline
        end

        -- ── Collide toggle ────────────────────────────────────────────────────
        if localChildcube and LocalPlayer.Character:FindFirstChild("Paint") and
           localChildcube.CanCollide ~= collide then
            local pp   = localChildcube.Position + localChildcube.Size / 2
            local args = {
                localChildcube, Enum.NormalId.Top, pp,
                "material", nil, "collide", ""
            }
            local collideDeadline = tick() + BLOCK_TIMEOUT
            repeat
                if LocalPlayer.Character and
                   not LocalPlayer.Character:FindFirstChild("Paint") and
                   LocalPlayer.Backpack:FindFirstChild("Paint") then
                    LocalPlayer.Backpack.Paint.Parent = LocalPlayer.Character
                end
                if LocalPlayer.Character and LocalPlayer.Character:FindFirstChild("Paint") then
                    local pt = LocalPlayer.Character.Paint
                    local ev = (pt:FindFirstChild("origevent") and pt.origevent) or
                               (pt:FindFirstChild("Script") and pt.Script:FindFirstChild("Event"))
                    if ev then
                        pcall(function() ev:FireServer(table.unpack(args)) end)
                    end
                end
                teleportToBuildPos(pp)
                task.wait(1)
            until not localChildcube or not localChildcube.Parent
                or localChildcube.CanCollide == collide
                or stopped or skipblock
                or tick() > collideDeadline
        end

        -- ── Sprays ────────────────────────────────────────────────────────────
        if localChildcube and sprays ~= nil and (
            LocalPlayer.Backpack:FindFirstChild("Paint") or
            LocalPlayer.Character:FindFirstChild("Paint")
        ) then
            local pp = localChildcube.Position + localChildcube.Size / 2
            for _, v in pairs(sprays) do
                if stopped or skipblock then break end
                local payload = v[3]
                if (not payload or payload == "") and type(v[2]) == "string" and v[2] ~= "" then
                    payload = v[2]
                end
                local args = {
                    localChildcube, Enum.NormalId[v[1]], pp,
                    "material", nil, "spray", payload or ""
                }
                pcall(function() LocalPlayer.Backpack.Paint.Parent = LocalPlayer.Character end)
                if LocalPlayer.Character:FindFirstChild("Paint") then
                    local pt = LocalPlayer.Character.Paint
                    local ev = (pt:FindFirstChild("origevent") and pt.origevent) or
                               (pt:FindFirstChild("Script") and pt.Script:FindFirstChild("Event"))
                    if ev then
                        pcall(function() ev:FireServer(table.unpack(args)) end)
                    end
                end
                teleportToBuildPos(pp)
                task.wait(0.25)
            end
        end

        -- ── Resize ────────────────────────────────────────────────────────────
        if localChildcube and bsizev3 ~= nil and (
            bsizev3.X ~= gridSize or
            bsizev3.Y ~= gridSize or
            bsizev3.Z ~= gridSize or
            needsresize
        ) and (
            LocalPlayer.Character:FindFirstChild("Shape") or
            LocalPlayer.Backpack:FindFirstChild("Shape")
        ) then
            if not LocalPlayer.Character:FindFirstChild("Shape") then
                LocalPlayer.Backpack.Shape.Parent = LocalPlayer.Character
            end
            local axes = {
                { Enum.NormalId.Right, "X" },
                { Enum.NormalId.Top,   "Y" },
                { Enum.NormalId.Back,  "Z" },
            }
            for _, axis in ipairs(axes) do
                local face, dim = axis[1], axis[2]
                if not localChildcube or not localChildcube.Parent then break end
                if localChildcube.Size[dim] == bsizev3[dim] then continue end

                local resizeDeadline = tick() + BLOCK_TIMEOUT
                repeat
                    if not localChildcube or not localChildcube.Parent then break end
                    local pp  = localChildcube.Position + localChildcube.Size / 2
                    local dir = nil
                    if localChildcube.Size[dim] > bsizev3[dim] then
                        dir = "decrease"
                    elseif localChildcube.Size[dim] < bsizev3[dim] then
                        dir = "increase"
                    end
                    if not dir then break end
                    if not LocalPlayer.Character:FindFirstChild("Shape") and
                       LocalPlayer.Backpack:FindFirstChild("Shape") then
                        LocalPlayer.Backpack.Shape.Parent = LocalPlayer.Character
                    end
                    if LocalPlayer.Character:FindFirstChild("Shape") then
                        local sh = LocalPlayer.Character.Shape
                        local ev = (sh:FindFirstChild("origevent") and sh.origevent) or
                                   (sh:FindFirstChild("Script") and sh.Script:FindFirstChild("Event"))
                        if ev then
                            pcall(function()
                                ev:FireServer(localChildcube, face, pp, dir)
                            end)
                        end
                    end
                    teleportToBuildPos(pp)
                    task.wait(resizewait)
                until not localChildcube or not localChildcube.Parent
                    or localChildcube.Size[dim] == bsizev3[dim]
                    or (dir == "decrease" and localChildcube and localChildcube.Size[dim] <= 1)
                    or stopped or skipblock
                    or tick() > resizeDeadline
            end
        end

        skipblock = false
        if oldprt then oldprt:Destroy() end
        localChildcube = nil
    end

    -- ── RunBuildSlice — slice first, sort slice, zero global crossfire ────────

    function RunBuildSlice(manifestId, filename)
        filename = filename or MANIFEST_FILE
        if not isBot then
            displayLocalMessage("Build only runs on bot accounts.")
            return
        end

        local manifest, err = parseManifest(filename)
        if not manifest then
            displayLocalMessage(err or "Manifest load failed.")
            return
        end

        local roster      = getBotRoster()
        local myIndex     = getLocalBotIndex(roster) or 1
        local botCount    = math.max(#roster, 1)
        local rotCF       = manifest.rotCF
        local offset      = manifest.offset
        local allBlocks   = manifest.blocks
        local buildCenter = (rotCF or offset) and computeBuildCenter(allBlocks) or nil

        -- Slice first — each bot sorts only its own assigned blocks
        local myBlocks = {}
        for i, v in ipairs(allBlocks) do
            if ((i - 1) % botCount) + 1 == myIndex then
                table.insert(myBlocks, v)
            end
        end
        myBlocks = sortBlocksByDistanceFromSpawn(myBlocks)

        if #myBlocks == 0 then
            displayLocalMessage("No blocks assigned to " .. LocalPlayer.Name)
            return
        end

        stopped   = false
        skipblock = false

        local total      = #myBlocks
        local placed     = 0
        local hardFailed = {}

        displayLocalMessage(string.format(
            "Build started: %d blocks assigned to %s", total, LocalPlayer.Name
        ))

        -- ── Pass 1 ────────────────────────────────────────────────────────────
        for i, v in ipairs(myBlocks) do
            if stopped then break end

            local bsz    = v.bsz
            local rawPos = Vector3.new(v.p[1], v.p[2], v.p[3])
            local pos    = transformBlockPos(rawPos, bsz, buildCenter, rotCF, offset)

            if pos.X ~= pos.X or pos.Y ~= pos.Y or pos.Z ~= pos.Z then continue end
            if pos.Magnitude > 100000 then continue end

            if blockConfirmedOnServer(pos, bsz, v.isDetail) then
                placed = placed + 1
                continue
            end

            createpartrepl(pos, bsz, v.col, swappedmaterials[v.mat] or Enum.Material.SmoothPlastic)
            buildblock(pos, v.mat, v.col, nil, bsz, true, nil, v.sprays, v.anch, v.coll, v.isDetail)

            if blockConfirmedOnServer(pos, bsz, v.isDetail) then
                placed = placed + 1
                v.placed = true
            else
                table.insert(hardFailed, v)
            end

            if i % 20 == 0 then
                displayLocalMessage(string.format(
                    "Progress: %d/%d (%d pending)", placed, total, #hardFailed
                ))
            end

            task.wait(0)
        end

        if stopped then
            displayLocalMessage("Build stopped.")
            return
        end

        -- ── Verification sweeps ───────────────────────────────────────────────
        if #hardFailed > 0 then
            displayLocalMessage(string.format(
                "Verification: %d blocks need retry sweeps", #hardFailed
            ))

            local retryQueue = hardFailed
            local pass       = 0

            while #retryQueue > 0 and pass < VERIFY_PASSES and not stopped do
                pass = pass + 1
                local stillFailed = {}

                for _, v in ipairs(retryQueue) do
                    if stopped then break end

                    local bsz    = v.bsz
                    local rawPos = Vector3.new(v.p[1], v.p[2], v.p[3])
                    local pos    = transformBlockPos(rawPos, bsz, buildCenter, rotCF, offset)

                    if blockConfirmedOnServer(pos, bsz, v.isDetail) then
                        placed = placed + 1
                        continue
                    end

                    createpartrepl(pos, bsz, v.col, swappedmaterials[v.mat] or Enum.Material.SmoothPlastic)
                    buildblock(pos, v.mat, v.col, nil, bsz, true, nil, v.sprays, v.anch, v.coll, v.isDetail)

                    if blockConfirmedOnServer(pos, bsz, v.isDetail) then
                        placed = placed + 1
                    else
                        table.insert(stillFailed, v)
                    end

                    task.wait(0)
                end

                retryQueue = stillFailed

                if #retryQueue > 0 then
                    displayLocalMessage(string.format(
                        "Sweep %d/%d done — %d still unplaced", pass, VERIFY_PASSES, #retryQueue
                    ))
                    task.wait(0.5)
                end
            end

            if #retryQueue > 0 then
                displayLocalMessage(string.format(
                    "⚠️ %d blocks permanently unplaceable after %d sweeps",
                    #retryQueue, VERIFY_PASSES
                ))
            else
                displayLocalMessage("✅ All blocks verified on server.")
            end
        end

        displayLocalMessage(string.format(
            "Build complete: %d/%d placed by %s", placed, total, LocalPlayer.Name
        ))
    end

    function StopBuild()
        stopped   = true
        skipblock = true
    end
end


-- ==========================================
-- OWNER AUTH
-- ==========================================
local COMMAND_LIST = [[
!antiafk [t/f]
!autor6 [t/f]
!blacklist [t/f]
!bkitcrash [stop]
!build [start/stop]
!cmds
!credits
!dall
!dance
!disablebkit
!donate [amount]
!fling [player]
!follow [player]
!fpsmode [t/f]
!freeze
!glaze [player]
!join
!jump
!quickvamp [player]
!rejoin
!reset
!say [message]
!servershutdown
!spin [speed]
!stop
!stopdance
!teleport
!tp2 [player]
!unfollow
!unfreeze
!unspin
!autodall [t/f]
]]

local ownerUsernames = {}

UserInputService.WindowFocusReleased:Connect(function()
    task.wait(0.1)
    ReplicatedStorage:WaitForChild("System"):FireServer("Focused")
end)

local success, response = pcall(function()
    return game:HttpGet(ownersURL)
end)

if success then
    ownerUsernames = HttpService:JSONDecode(response)
else
    warn("Failed to load owners!")
    _G.BotScriptLoaded = nil
    return
end

local function loadBlacklist()
    local ok, res = pcall(function()
        return game:HttpGet(blacklistURL)
    end)
    if ok and res then
        blacklistedPlayers = HttpService:JSONDecode(res)
        local count = 0
        for _, val in pairs(blacklistedPlayers) do
            if val == true then count = count + 1 end
        end
        print("Blacklist loaded: " .. count .. " active entries")
    else
        warn("Failed to load blacklist!")
    end
end

local function isBlacklisted(player)
    return blacklistedPlayers[player.Name] == true
end

local function chat(msg)
    if chatChannel then
        pcall(function() chatChannel:SendAsync(msg) end)
    else
        pcall(function()
            ReplicatedStorage.DefaultChatSystemChatEvents.SayMessageRequest:FireServer(msg, "All")
        end)
    end
end

local function punishPlayer(player)
    if LocalPlayer.Name ~= BLACKLIST_ACCOUNT then return end
    local character = LocalPlayer.Character
    local backpack  = LocalPlayer:FindFirstChild("Backpack")
    if not character or not backpack then return end
    local humanoid   = character:FindFirstChildOfClass("Humanoid")
    local arkenstone = character:FindFirstChild("The Arkenstone") or backpack:FindFirstChild("The Arkenstone")
    if arkenstone then
        if arkenstone.Parent == backpack then
            humanoid:EquipTool(arkenstone)
            task.wait(0.5)
        end
    end
    print("punishing player")
    chat(";freeze " .. player.Name)
    task.wait(0.5)
    chat(";mute " .. player.Name)
    task.wait(1)
    chat(";glitch " .. player.Name)
    print("done")
end

local function sendWebhookLog(executor, command, args, cmdSuccess, cmdError)
    if LocalPlayer.Name ~= WHITELIST_ACCOUNT then return end

    local timestamp = os.date("!%Y-%m-%d %H:%M:%S UTC")
    local statusIcon = cmdSuccess and "✅" or "❌"
    local color = cmdSuccess and 3066993 or 15158332

    local fields = {
        { name = "👤 Executor",           value = "```" .. executor .. "```",                              inline = true  },
        { name = "⌨️ Command",            value = "```!" .. command .. "```",                              inline = true  },
        { name = "📝 Arguments",          value = args ~= "" and ("```" .. args .. "```") or "```None```", inline = true  },
        { name = statusIcon .. " Status", value = cmdSuccess and "```Success```" or "```Failed```",        inline = true  },
        { name = "🎮 Game ID",            value = "```" .. GameId .. "```",                                inline = true  },
        { name = "🔑 Job ID",             value = "```" .. JobId .. "```",                                 inline = true  },
        { name = "🕐 Timestamp",          value = "```" .. timestamp .. "```",                             inline = false },
    }

    if cmdError then
        table.insert(fields, { name = "⚠️ Error", value = "```" .. cmdError .. "```", inline = false })
    end

    local payload = HttpService:JSONEncode({
        username = "Alt Bot Logger",
        embeds = {{
            title  = statusIcon .. " Command Executed",
            color  = color,
            fields = fields,
            footer = { text = "blacklistv2tco • Alt Bot V4.5" }
        }}
    })

    pcall(function()
        request({ Url = WEBHOOK_URL, Method = "POST", Headers = { ["Content-Type"] = "application/json" }, Body = payload })
    end)
end

local function isOwner(player)
    return ownerUsernames[player.Name] == true
end

local function findPlayerByPartial(partial)
    partial = partial:lower()
    for _, p in ipairs(Players:GetPlayers()) do
        if p.Name:lower():find(partial, 1, true) or p.DisplayName:lower():find(partial, 1, true) then
            return p
        end
    end
    return nil
end

local VirtualUser = game:GetService("VirtualUser")
local VIM = game:GetService("VirtualInputManager")

task.spawn(function()
    while true do
        task.wait(600)
        if antiafk then
            VIM:SendMouseButtonEvent(0, 0, 0, true, game, 0)
            task.wait(0.1)
            VIM:SendMouseButtonEvent(0, 0, 0, false, game, 0)
        end
    end
end)

task.spawn(function()
    while true do
        if following and followTarget then
            local myChar     = LocalPlayer.Character
            local targetChar = followTarget.Character
            if myChar and targetChar then
                local myHRP     = myChar:FindFirstChild("HumanoidRootPart")
                local targetHRP = targetChar:FindFirstChild("HumanoidRootPart")
                if myHRP and targetHRP then
                    myHRP.CFrame = targetHRP.CFrame * CFrame.new(0, 0, 3)
                end
            end
        end
        task.wait(0.1)
    end
end)

task.spawn(function()
    while task.wait(1) do
        if not pollerRunning then break end
        if not autoDallEnabled then continue end
        local ok, timeValue = pcall(function()
            return LocalPlayer.leaderstats.Time.Value
        end)
        if not ok or type(timeValue) ~= "number" then continue end
        if timeValue < 100 then continue end
        chat(";donate " .. autoDallTarget .. " " .. timeValue)
        task.wait(5)
    end
end)

Players.PlayerAdded:Connect(function(newPlayer)
    if blacklistEnabled and isBlacklisted(newPlayer) then
        task.wait(1)
        punishPlayer(newPlayer)
    end

    if autoR6 then
        local character = LocalPlayer.Character
        local backpack  = LocalPlayer:FindFirstChild("Backpack")
        if not character or not backpack then return end
        local humanoid   = character:FindFirstChildOfClass("Humanoid")
        local arkenstone = character:FindFirstChild("The Arkenstone") or backpack:FindFirstChild("The Arkenstone")
        if arkenstone then
            if arkenstone.Parent == backpack then humanoid:EquipTool(arkenstone) task.wait(0.5) end
            task.wait(1)
            chat(";r6 " .. newPlayer.Name)
        end
    end
end)


-- ==========================================
-- ANTI-GRIEF DETECTION
-- ==========================================
local agEnabled = false
local agCooldowns = {}
local agCooldownTime = 30
local agTimeFilter = 0
local agWhitelist = { [LocalPlayer.Name] = true }
local agInGame = true
local agEnlighten = true

local agDetectDelete = false
local agDetectPaint = false
local agDetectAnchor = false
local agDetectSpam = false

local blockOwners = {}
local spamCounters = {}

local griefMessages = {
    ["delete"] = "🚨 GRIEF ALERT: %s is deleting blocks",
    ["paint"]  = "🚨 GRIEF ALERT: %s is grief painting",
    ["build"]  = "🚨 GRIEF ALERT: %s is spamming blocks",
    ["anchor"] = "🚨 GRIEF ALERT: %s is unanchoring blocks",
}

local function isCooledDown(playerName)
    if agCooldownTime == 0 then return true end
    local last = agCooldowns[playerName]
    if not last then return true end
    return tick() - last >= agCooldownTime
end

local function setCooldown(playerName)
    agCooldowns[playerName] = tick()
end

local function isAGWhitelisted(player)
    return agWhitelist[player.Name] == true
end

local function checkTimeFilter(player)
    if agTimeFilter == 0 then return true end
    local ok, val = pcall(function()
        return player.leaderstats.Time.Value
    end)
    return ok and type(val) == "number" and val < agTimeFilter
end

local function checkEnlighten(player)
    if agEnlighten then return true end
    local char = player.Character
    local bp = player.Backpack
    if char and (char:FindFirstChild("The Arkenstone") or (bp and bp:FindFirstChild("The Arkenstone"))) then
        return false
    end
    return true
end

local function shouldDetect(player)
    if not agEnabled then return false end
    if isAGWhitelisted(player) then return false end
    if not checkEnlighten(player) then return false end
    if not checkTimeFilter(player) then return false end
    if not isCooledDown(player.Name) then return false end
    return true
end

local function flagPlayer(player, griefType)
    if not shouldDetect(player) then return end
    setCooldown(player.Name)
    local template = griefMessages[griefType] or "🚨 GRIEF ALERT: %s is griefing"
    chat(string.format(template, player.DisplayName))
end

local agConnections = {}

local function stopAGDetection()
    for _, conn in ipairs(agConnections) do
        conn:Disconnect()
    end
    agConnections = {}
    blockOwners   = {}
    spamCounters  = {}
    agCooldowns   = {}
end

local function startAGDetection()
    stopAGDetection()

    local folder = workspace:FindFirstChild("Cubes") or workspace:FindFirstChild("Bricks")
    if not folder then
        chat("❌ Could not find build folder (Cubes/Bricks)")
        return
    end

    local function trackPlacement(player)
        -- Wait up to 5 seconds for the subfolder to appear
        local playerFolder = folder:FindFirstChild(player.Name)
        if not playerFolder then
            local t0 = tick()
            local waitConn
            waitConn = folder.ChildAdded:Connect(function(child)
                if child.Name == player.Name then
                    waitConn:Disconnect()
                    playerFolder = child
                end
            end)
            repeat task.wait(0.1) until playerFolder or tick() - t0 > 5
            if waitConn then pcall(function() waitConn:Disconnect() end) end
        end

        if not playerFolder then
            -- Game might not use subfolders, watch the root folder instead
            playerFolder = folder
        end

        local conn = playerFolder.ChildAdded:Connect(function(block)
            blockOwners[block] = player.Name

            -- Spam detection
            if agDetectSpam then
                spamCounters[player.Name] = (spamCounters[player.Name] or 0) + 1
                local count = spamCounters[player.Name]
                task.delay(5, function()
                    spamCounters[player.Name] = math.max(0, (spamCounters[player.Name] or 0) - 1)
                end)
                if count >= 10 then
                    spamCounters[player.Name] = 0
                    flagPlayer(player, "build")
                end
            end

            -- Watch the block for changes
            if agDetectDelete then
                local delConn
                delConn = block:GetPropertyChangedSignal("Parent"):Connect(function()
                    if block.Parent == nil then
                        delConn:Disconnect()
                        -- Find the most likely griefer (last active non-owner player)
                        for _, p in ipairs(Players:GetPlayers()) do
                            if p.Name ~= player.Name and p ~= LocalPlayer then
                                if agInGame or p.Parent then
                                    flagPlayer(p, "delete")
                                    break
                                end
                            end
                        end
                    end
                end)
                table.insert(agConnections, delConn)
            end

            if agDetectPaint then
                local paintConn
                paintConn = block:GetPropertyChangedSignal("Color"):Connect(function()
                    for _, p in ipairs(Players:GetPlayers()) do
                        if p.Name ~= player.Name and p ~= LocalPlayer then
                            flagPlayer(p, "paint")
                            break
                        end
                    end
                end)
                table.insert(agConnections, paintConn)
            end

            if agDetectAnchor then
                local anchorConn
                anchorConn = block:GetPropertyChangedSignal("Anchored"):Connect(function()
                    if not block.Anchored then
                        for _, p in ipairs(Players:GetPlayers()) do
                            if p.Name ~= player.Name and p ~= LocalPlayer then
                                flagPlayer(p, "anchor")
                                break
                            end
                        end
                    end
                end)
                table.insert(agConnections, anchorConn)
            end
        end)

        table.insert(agConnections, conn)
    end

    -- Track all current players
    for _, p in ipairs(Players:GetPlayers()) do
        if p ~= LocalPlayer then
            task.spawn(function() trackPlacement(p) end)
        end
    end

    -- Track players who join later
    local joinConn = Players.PlayerAdded:Connect(function(p)
        if p ~= LocalPlayer then
            task.spawn(function()
                task.wait(2) -- give time for their folder to be created
                trackPlacement(p)
            end)
        end
    end)
    table.insert(agConnections, joinConn)

    chat("✅ Anti-grief detection started")
end

-- ==========================================
-- GRIEF AURAS (from CMDLINE2.0)
-- ==========================================
local griefAuraActive = false
local unanchorAuraActive = false
local sprayAuraActive = false

local function findBtoolsBot(name)
    local btools = {}
    local backpack = LocalPlayer:FindFirstChildOfClass("Backpack")
    local char = LocalPlayer.Character
    if backpack then
        for _, v in ipairs(backpack:GetChildren()) do
            if v:IsA("Tool") and v.Name == name then
                if isog then
                    local events = LocalPlayer.Backpack:FindFirstChild("Events")
                    if events then table.insert(btools, { bt = v, e = events }) end
                elseif v:FindFirstChild("Script") and v.Script:FindFirstChild("Event") then
                    table.insert(btools, { bt = v, e = v.Script.Event })
                end
            end
        end
    end
    if char then
        for _, v in ipairs(char:GetChildren()) do
            if v:IsA("Tool") and v.Name == name then
                if isog then
                    local events = LocalPlayer.Backpack:FindFirstChild("Events")
                    if events then
                        local found = false
                        for _, b in ipairs(btools) do if b.bt == v then found = true end end
                        if not found then table.insert(btools, { bt = v, e = events }) end
                    end
                elseif v:FindFirstChild("Script") and v.Script:FindFirstChild("Event") then
                    local found = false
                    for _, b in ipairs(btools) do if b.bt == v then found = true end end
                    if not found then table.insert(btools, { bt = v, e = v.Script.Event }) end
                end
            end
        end
    end
    return btools
end

local function startGriefAura()
    griefAuraActive = true
    local folder = workspace:FindFirstChild("Cubes") or workspace:FindFirstChild("Bricks")
    task.spawn(function()
        while griefAuraActive do
            local ok, err = pcall(function()
                local hrp = LocalPlayer.Character and LocalPlayer.Character:FindFirstChild("HumanoidRootPart")
                if hrp and folder then
                    local dtools = findBtoolsBot("Delete")
                    if #dtools > 0 then
                        for _, p in ipairs(Players:GetPlayers()) do
                            if p ~= LocalPlayer and p.Character then
                                local hrp2 = p.Character:FindFirstChild("HumanoidRootPart")
                                if hrp2 then
                                    local cubes = {}
                                    for _, v in ipairs(folder:GetDescendants()) do
                                        if v:IsA("BasePart") then
                                            table.insert(cubes, { v, (v.Position - hrp2.Position).Magnitude })
                                        end
                                    end
                                    table.sort(cubes, function(a, b) return a[2] < b[2] end)
                                    for _, v in ipairs(cubes) do
                                        if not griefAuraActive then break end
                                        local dt = dtools[math.random(#dtools)]
                                        dt.bt.Parent = LocalPlayer.Character
                                        if isog then
                                            dt.e:FireServer(hrp.Position, Enum.NormalId.Top, v[1], Color3.new(0,0,0), "Smooth")
                                        else
                                            dt.e:FireServer(v[1], hrp.Position)
                                        end
                                        task.wait(0.1)
                                    end
                                end
                            end
                        end
                    end
                end
            end)
            if not ok then warn("[GriefAura]", err) end
            task.wait()
        end
    end)
end

local function startUnanchorAura()
    unanchorAuraActive = true
    local folder = workspace:FindFirstChild("Cubes") or workspace:FindFirstChild("Bricks")
    task.spawn(function()
        local pti = 0
        while unanchorAuraActive do
            local ok, err = pcall(function()
                local hrp = LocalPlayer.Character and LocalPlayer.Character:FindFirstChild("HumanoidRootPart")
                if hrp and folder then
                    local paints = findBtoolsBot("Paint")
                    if #paints > 0 then
                        local cubes = {}
                        for _, v in ipairs(folder:GetDescendants()) do
                            if v:IsA("BasePart") and v.Anchored == true then
                                table.insert(cubes, { v, (v.Position - hrp.Position).Magnitude })
                            end
                        end
                        table.sort(cubes, function(a, b) return a[2] < b[2] end)
                        for _, v in ipairs(cubes) do
                            if not unanchorAuraActive then break end
                            pti = pti + 1
                            local pt = paints[(pti % #paints) + 1]
                            pt.bt.Parent = LocalPlayer.Character
                            pt.e:FireServer(
                                v[1], Enum.NormalId.Top, hrp.Position,
                                "material", Color3.new(0,0,0), "anchor", ""
                            )
                            task.wait(0.1)
                        end
                    end
                end
            end)
            if not ok then warn("[UnanchorAura]", err) end
            task.wait()
        end
    end)
end

local function startSprayAura()
    sprayAuraActive = true
    local folder = workspace:FindFirstChild("Cubes") or workspace:FindFirstChild("Bricks")
    task.spawn(function()
        local pti = 0
        local sides = {
            Enum.NormalId.Front, Enum.NormalId.Back,
            Enum.NormalId.Left,  Enum.NormalId.Right,
            Enum.NormalId.Top,
        }
        while sprayAuraActive do
            local ok, err = pcall(function()
                local hrp = LocalPlayer.Character and LocalPlayer.Character:FindFirstChild("HumanoidRootPart")
                if hrp and folder then
                    local paints = findBtoolsBot("Paint")
                    if #paints > 0 then
                        local cubes = {}
                        for _, v in ipairs(folder:GetDescendants()) do
                            if v:IsA("BasePart") then
                                table.insert(cubes, { v, (v.Position - hrp.Position).Magnitude })
                            end
                        end
                        table.sort(cubes, function(a, b) return a[2] < b[2] end)
                        for _, v in ipairs(cubes) do
                            if not sprayAuraActive then break end
                            pti = pti + 1
                            local pt = paints[(pti % #paints) + 1]
                            pt.bt.Parent = LocalPlayer.Character
                            pt.e:FireServer(
                                v[1], sides[math.random(#sides)], hrp.Position,
                                "both \u{1F91D}", Color3.fromRGB(30, 245, 2),
                                "spray", "raided by hotdogn and tcoraids"
                            )
                            task.wait(0.1)
                        end
                    end
                end
            end)
            if not ok then warn("[SprayAura]", err) end
            task.wait()
        end
    end)
end


-- ==========================================
-- FORMATION STATE
-- ==========================================
local formationMode = "idle"
local formationAccumulator = 0

local FOLLOW_SIDE_SPACING   = 4
local FOLLOW_ROW_DEPTH      = 3.5
local FOLLOW_DISTANCE       = 3
local FOLLOW_WALK_STOP_DIST = 2.4
local FOLLOW_TELEPORT_DIST  = 75
local FOLLOW_REPATH_INT     = 0.75
local FOLLOW_STUCK_SECS     = 3.5

local LINE_SPACING     = 5
local LINE_DISTANCE    = 9
local CIRCLE_RADIUS    = 10
local ORBIT_RADIUS     = 11
local ORBIT_SPEED      = 1.4
local TOWER_SPACING    = 4.2
local TOWER_DISTANCE   = 5
local SCATTER_RADIUS   = 15
local SHAPE_RADIUS     = 12
local SHAPE_SPACING    = 4
local SHAPE_DISTANCE   = 12

local followStuckSince    = nil
local followStuckCheckPos = nil
local lastFollowMoveTo    = 0

-- Formation target: the first non-bot player found, or whoever was explicitly
-- set by !formation follow <name>. Defaults to any non-bot in the server.
local formationTarget = nil  -- Player instance; nil = auto-pick

local function getFormationOwnerRoot()
    -- Explicit target set by command takes priority
    local target = formationTarget
    if target and target.Character then
        local r = target.Character:FindFirstChild("HumanoidRootPart")
        if r then return r end
    end

    -- Auto-pick: first player who is NOT in BOT_NAMES
    local function isBotName(name)
        for _, n in ipairs(BOT_NAMES) do
            if n == name then return true end
        end
        return false
    end

    for _, p in ipairs(Players:GetPlayers()) do
        if p ~= LocalPlayer and not isBotName(p.Name) and p.Character then
            local r = p.Character:FindFirstChild("HumanoidRootPart")
            if r then return r end
        end
    end
    return nil
end

local function safeTeleport(cf)
    local char = LocalPlayer.Character
    local root = char and char:FindFirstChild("HumanoidRootPart")
    local hum  = char and char:FindFirstChildOfClass("Humanoid")
    if not root or not hum or hum.Health <= 0 then return end
    pcall(function()
        hum.Sit = false
        root.AssemblyLinearVelocity = Vector3.zero
        root.AssemblyAngularVelocity = Vector3.zero
        root.CFrame = cf
    end)
end

local function computeFollowCFrame(ownerRoot, roster, index)
    local count  = math.max(#roster, 1)
    local perRow = math.clamp(math.ceil(math.sqrt(count)), 2, 5)
    local row    = math.floor((index - 1) / perRow)
    local col    = (index - 1) % perRow
    local rowStart  = row * perRow
    local rowCount  = math.min(perRow, count - rowStart)
    local centerOff = col - ((rowCount - 1) / 2)
    return ownerRoot.CFrame * CFrame.new(
        centerOff * FOLLOW_SIDE_SPACING, 0,
        FOLLOW_DISTANCE + row * FOLLOW_ROW_DEPTH
    )
end

local function computeFormationCFrame(ownerRoot, roster, index)
    local count = math.max(#roster, 1)
    local O   = ownerRoot.Position
    local R   = ownerRoot.CFrame.RightVector
    local L   = ownerRoot.CFrame.LookVector
    local U   = ownerRoot.CFrame.UpVector
    local sp  = SHAPE_SPACING
    local rad = SHAPE_RADIUS
    local dist = SHAPE_DISTANCE

    local function faceOwner(pos) return CFrame.lookAt(pos, O) end
    local function faceFwd(pos)   return CFrame.lookAt(pos, pos + L) end

    if formationMode == "line" then
        local centerOff = index - ((count + 1) / 2)
        local base = ownerRoot.CFrame * CFrame.new(0, 0, LINE_DISTANCE)
        local pos  = base.Position + R * (centerOff * LINE_SPACING)
        return CFrame.lookAt(pos, pos + L)

    elseif formationMode == "circle" then
        local angle = ((index - 1) / count) * math.pi * 2
        local pos = O + R * math.cos(angle) * CIRCLE_RADIUS
                      + L * math.sin(angle) * CIRCLE_RADIUS
        return CFrame.lookAt(pos, O)

    elseif formationMode == "orbit" then
        local angle = (os.clock() * ORBIT_SPEED) + (((index - 1) / count) * math.pi * 2)
        local pos = O + R * math.cos(angle) * ORBIT_RADIUS
                      + L * math.sin(angle) * ORBIT_RADIUS
        return CFrame.lookAt(pos, O)

    elseif formationMode == "tower" then
        local base = ownerRoot.CFrame * CFrame.new(0, 0, -TOWER_DISTANCE)
        local pos  = base.Position + Vector3.new(0, (index - 1) * TOWER_SPACING, 0)
        return CFrame.lookAt(pos, pos + L)

    elseif formationMode == "scatter" then
        local angle  = math.rad((index * 137) % 360)
        local radius = SCATTER_RADIUS + ((index % 4) * 2)
        local pos    = O + R * math.cos(angle) * radius + L * math.sin(angle) * radius
        return CFrame.lookAt(pos, O)

    elseif formationMode == "square" then
        local t    = ((index - 1) % count) / count * 4
        local side = math.floor(t); local f = t - side
        local sx, sz
        if side == 0 then      sx, sz = -rad + 2*rad*f, -rad
        elseif side == 1 then  sx, sz =  rad,           -rad + 2*rad*f
        elseif side == 2 then  sx, sz =  rad - 2*rad*f,  rad
        else                   sx, sz = -rad,             rad - 2*rad*f end
        return faceOwner(O + R*sx + L*sz)

    elseif formationMode == "diamond" then
        local verts = { {0,-rad},{rad,0},{0,rad},{-rad,0},{0,-rad} }
        local t = ((index-1)%count)/count*4; local side = math.floor(t); local f = t-side
        local a, b = verts[side+1], verts[side+2]
        return faceOwner(O + R*(a[1]+(b[1]-a[1])*f) + L*(a[2]+(b[2]-a[2])*f))

    elseif formationMode == "grid" then
        local cols = math.max(math.ceil(math.sqrt(count)), 1)
        local row  = math.floor((index-1)/cols); local col = (index-1)%cols
        return faceFwd(O + L*dist + R*((col-(cols-1)/2)*sp) + L*(row*sp))

    elseif formationMode == "wall" then
        local cols = math.max(math.ceil(math.sqrt(count)), 1)
        local row  = math.floor((index-1)/cols); local col = (index-1)%cols
        return faceFwd(O + L*dist + R*((col-(cols-1)/2)*sp) + U*(row*sp))

    elseif formationMode == "triangle" then
        local row, placed = 0, 0
        while placed + (row+1) < index do placed = placed+(row+1); row = row+1 end
        local posInRow = index - placed - 1
        return faceFwd(O + L*dist + R*((posInRow - row/2)*sp) + L*(row*sp))

    elseif formationMode == "pyramid" then
        local n = 1
        while n*(n+1)/2 < count do n = n+1 end
        local row, placed, width = 0, 0, n
        while placed+width < index and width > 1 do
            placed = placed+width; row = row+1; width = n-row
        end
        local posInRow = index - placed - 1
        return faceFwd(O + L*dist + R*((posInRow-(width-1)/2)*sp) + U*(row*sp))

    elseif formationMode == "cross" then
        local arm = math.floor((index-1)/4); local dir = (index-1)%4
        local off = (arm+1)*sp; local dx, dz = 0, 0
        if dir == 0 then dz = off elseif dir == 1 then dz = -off
        elseif dir == 2 then dx = off else dx = -off end
        return faceOwner(O + R*dx + L*dz)

    elseif formationMode == "wedge" then
        local depth    = math.ceil(index/2)
        local sideSign = (index%2 == 0) and 1 or -1
        return faceFwd(O + L*dist + R*(sideSign*depth*sp*0.7) - L*(depth*sp))

    elseif formationMode == "arc" then
        local a   = (count == 1) and 0.5 or ((index-1)/(count-1))
        local ang = math.rad(-90 + a*180)
        return faceOwner(O + R*math.sin(ang)*rad + L*math.cos(ang)*rad)

    elseif formationMode == "zigzag" then
        local sideSign = (index%2 == 0) and 1 or -1
        return faceFwd(O + L*dist + L*((index-1)*sp) + R*(sideSign*sp))

    elseif formationMode == "star" then
        local t = ((index-1)%count)/count; local ang = t*math.pi*2
        local rr = (math.floor(t*10)%2 == 0) and rad or rad*0.45
        return faceOwner(O + R*math.cos(ang)*rr + L*math.sin(ang)*rr)

    elseif formationMode == "spiral" then
        local ang = (index-1)*0.6; local rr = 3+(index-1)*sp*0.35
        return faceOwner(O + R*math.cos(ang)*rr + L*math.sin(ang)*rr)

    elseif formationMode == "heart" then
        local s = rad/16; local t = ((index-1)%count)/count*math.pi*2
        local hx = 16*math.sin(t)^3
        local hz = 13*math.cos(t) - 5*math.cos(2*t) - 2*math.cos(3*t) - math.cos(4*t)
        return faceOwner(O + R*(hx*s) + L*(hz*s))
    end

    return nil
end

-- Formation heartbeat — runs on EVERY client (bot or not). Bots move
-- themselves; the owner client does nothing because it's not in the bot roster.
RunService.Heartbeat:Connect(function(dt)
    if formationMode == "idle" then return end

    -- Only bot accounts should physically move in formation
    if not isBot then return end

    formationAccumulator = formationAccumulator + dt
    if formationAccumulator < 0.03 then return end
    formationAccumulator = 0

    local ownerRoot = getFormationOwnerRoot()
    if not ownerRoot then return end

    local roster = getBotRoster()
    local index  = getLocalBotIndex(roster)
    if not index then return end  -- this bot isn't in the roster

    if formationMode == "follow" then
        local char = LocalPlayer.Character
        local hum  = char and char:FindFirstChildOfClass("Humanoid")
        local root = char and char:FindFirstChild("HumanoidRootPart")
        if not root or not hum or hum.Health <= 0 then return end

        local targetPos = computeFollowCFrame(ownerRoot, roster, index).Position
        local dist = (root.Position - targetPos).Magnitude

        if dist > FOLLOW_TELEPORT_DIST then
            safeTeleport(CFrame.lookAt(targetPos, targetPos + ownerRoot.CFrame.LookVector))
            lastFollowMoveTo = 0; followStuckSince = nil; followStuckCheckPos = nil
            return
        end

        if dist > FOLLOW_WALK_STOP_DIST then
            local now = os.clock()
            if now - lastFollowMoveTo > FOLLOW_REPATH_INT then
                lastFollowMoveTo = now
                pcall(function() hum:MoveTo(targetPos) end)
            end
            if not followStuckCheckPos then
                followStuckCheckPos = root.Position
                followStuckSince    = now
            elseif (root.Position - followStuckCheckPos).Magnitude < 2 then
                if followStuckSince and now - followStuckSince > FOLLOW_STUCK_SECS then
                    hum.Jump = true
                    followStuckSince = now
                end
            else
                followStuckCheckPos = root.Position
                followStuckSince    = now
            end
        else
            pcall(function() hum:MoveTo(root.Position) end)
            followStuckSince = nil; followStuckCheckPos = nil
        end
        return
    end

    local cf = computeFormationCFrame(ownerRoot, roster, index)
    if cf then safeTeleport(cf) end
end)


-- ==========================================
-- COMMAND HANDLER
-- ==========================================
local function handleMessage(message, fromGitHub, githubCommand)
    local player
    local msg

    if fromGitHub then
        player = LocalPlayer
        msg = commandPrefix .. githubCommand
    else
        if not message.TextSource then return end
        player = Players:GetPlayerByUserId(message.TextSource.UserId)
        if not player then return end
        if not isOwner(player) and not tempAdmins[player.Name] then return end
        msg = tostring(message.Text)
    end

    local command, text = msg:match("^" .. commandPrefix .. "(%w+)%s*(.*)$")
    if not command then return end

    command = string.lower(command)
    local cmdSuccess = false
    local cmdError   = nil

    if command == "blacklist" then
        if text:lower() == "t" or text:lower() == "on" then
            loadBlacklist()
            blacklistEnabled = true
            chat("Blacklist enabled")
            cmdSuccess = true
        elseif text:lower() == "f" or text:lower() == "off" then
            blacklistEnabled = false
            chat("Blacklist disabled")
            cmdSuccess = true
        else
            cmdError = "Use !blacklist t or !blacklist f"
        end
        
        elseif command == "build" then
    local parts = {}
    for w in text:gmatch("%S+") do table.insert(parts, w) end
    local sub = (parts[1] or ""):lower()

    if sub == "save" then
        local filename = parts[2] or MANIFEST_FILE
        if not filename:match("%.json$") then filename = filename .. ".json" end
        task.spawn(function() saveBuild(filename) end)
        chat("Saving to " .. filename)
        cmdSuccess = true

    elseif sub == "start" or sub == "on" or sub == "t" then
        local filename = parts[2] or MANIFEST_FILE
        if not filename:match("%.json$") then filename = filename .. ".json" end
        task.spawn(function() RunBuildSlice(nil, filename) end)
        chat("Build started from " .. filename)
        cmdSuccess = true

    elseif sub == "stop" or sub == "off" or sub == "f" then
        StopBuild()
        chat("Build stopped")
        cmdSuccess = true

    else
        cmdError = "Use !build save [name.json] | !build start [name.json] | !build stop"
    end

        elseif command == "bkitcrash" or command == "bk" then
    local sub = text:lower()
    print("[CMD] received command:", command)
    if sub == "stop" or sub == "f" or sub == "off" then
        stopBkitCrash()
        chat("Crash stopped.")
        cmdSuccess = true
    else
        local ok, err = pcall(runBkitCrash)
        if not ok then
            warn("[BkitCrash] pcall error:", err)
            chat("Crash error: " .. tostring(err))
            cmdError = err
        else
            cmdSuccess = true
        end
        chat("Crash running.")
    end

	elseif command == "prefix" then
    if not isOwner(player) then
        cmdError = "Unauthorized"
    elseif text == "" then
        chat("Current prefix is: " .. commandPrefix)
        cmdSuccess = true
    else
        local newPrefix = text:gsub("%s+", "")
        if #newPrefix == 0 then
            cmdError = "Prefix cannot be empty"
        else
            commandPrefix = newPrefix
            chat("Prefix changed to: " .. commandPrefix)
            cmdSuccess = true
        end
    end

	elseif command == "ta" then
    if text == "" then
        cmdError = "No target specified"
    else
        local target = findPlayerByPartial(text)
        if not target then
            cmdError = "Player not found"
        else
            tempAdmins[target.Name] = true
            chat("✅ " .. target.DisplayName .. " has been given temporary admin")
            cmdSuccess = true
        end
    end

elseif command == "ta" and text:lower():sub(1, 6) == "revoke" then
    local name = text:sub(8):gsub("^%s+", "")
    local target = findPlayerByPartial(name)
    if not target then
        cmdError = "Player not found"
    else
        tempAdmins[target.Name] = nil
        chat("❌ " .. target.DisplayName .. " temporary admin revoked")
        cmdSuccess = true
    end

elseif command == "tarevoke" or command == "tar" then
    if text == "" then
        cmdError = "No target specified"
    else
        local target = findPlayerByPartial(text)
        if not target then
            cmdError = "Player not found"
        else
            tempAdmins[target.Name] = nil
            chat("❌ " .. target.DisplayName .. " temporary admin revoked")
            cmdSuccess = true
        end
    end

elseif command == "talist" then
    if next(tempAdmins) == nil then
        chat("No temporary admins active")
    else
        local names = {}
        for name, _ in pairs(tempAdmins) do
            table.insert(names, name)
        end
        chat("Temp admins: " .. table.concat(names, ", "))
    end
    cmdSuccess = true

    elseif command == "dela" or command == "deleteaura" then
    local sub = text:lower()
    if sub == "f" or sub == "off" or sub == "stop" then
        griefAuraActive = false
        chat("Delete aura OFF")
        cmdSuccess = true
    else
        startGriefAura()
        chat("Delete aura ON")
        cmdSuccess = true
    end

elseif command == "uaa" or command == "unanchoraura" then
    local sub = text:lower()
    if sub == "f" or sub == "off" or sub == "stop" then
        unanchorAuraActive = false
        chat("Unanchor aura OFF")
        cmdSuccess = true
    else
        startUnanchorAura()
        chat("Unanchor aura ON")
        cmdSuccess = true
    end

elseif command == "spray" or command == "sprayaura" then
    local sub = text:lower()
    if sub == "f" or sub == "off" or sub == "stop" then
        sprayAuraActive = false
        chat("Spray aura OFF")
        cmdSuccess = true
    else
        startSprayAura()
        chat("Spray aura ON")
        cmdSuccess = true
    end

    elseif command == "cmds" then
        local payload = HttpService:JSONEncode({
            username = "Alt Bot Commands",
            embeds = {{ title = "📜 Available Commands", description = "```" .. COMMAND_LIST .. "```", color = 3447003, footer = { text = "Alt Bot V4.5" } }}
        })
        pcall(function()
            request({ Url = WEBHOOK_URL, Method = "POST", Headers = { ["Content-Type"] = "application/json" }, Body = payload })
        end)
        cmdSuccess = true

    elseif command == "join" then
        pcall(function()
            local res = request({ Url = "http://localhost:3000/playerstuff", Method = "GET" })
            local data = HttpService:JSONDecode(res.Body)
            if not data.placeId or not data.jobId then
                cmdError = "No player information available"
                return
            end
            queue_on_teleport(game:HttpGet("https://raw.githubusercontent.com/Ali-droidlol/BlacklistTCO/refs/heads/main/BotScript.lua"))
            task.wait(5)
            TeleportService:TeleportToPlaceInstance(tonumber(data.placeId), data.jobId, LocalPlayer)
            cmdSuccess = true
        end)

    elseif command == "say" then
        if text ~= "" then
            pcall(function() chat(text) cmdSuccess = true end)
        else
            cmdError = "No message provided"
        end

    elseif command == "fpsmode" then
        if text:lower() == "t" or text:lower() == "on" then
            pcall(function()
                game:GetService("RunService"):Set3dRenderingEnabled(false)
                setfpscap(15)
                cmdSuccess = true
                chat("RAM saving mode enabled")
            end)
        elseif text:lower() == "f" or text:lower() == "off" then
            pcall(function()
                game:GetService("RunService"):Set3dRenderingEnabled(true)
                setfpscap(240)
                cmdSuccess = true
                chat("RAM saving mode disabled")
            end)
        else
            cmdError = "Use !fpsmode t or !fpsmode f"
        end

    elseif command == "teleport" or command == "tp" then
        pcall(function()
            local myChar    = LocalPlayer.Character
            local ownerChar = player.Character
            if myChar and ownerChar then
                local myHRP    = myChar:FindFirstChild("HumanoidRootPart")
                local ownerHRP = ownerChar:FindFirstChild("HumanoidRootPart")
                if myHRP and ownerHRP then myHRP.CFrame = ownerHRP.CFrame cmdSuccess = true end
            end
        end)


        elseif command == "ag" or command == "antigrief" then
    if LocalPlayer.Name ~= BLACKLIST_ACCOUNT then
        cmdError = "Unauthorized"
    else
        local sub = text:lower()

        if sub == "t" or sub == "on" then
            agEnabled       = true
            agDetectDelete  = true
            agDetectPaint   = true
            agDetectAnchor  = true
            agDetectSpam    = true
            startAGDetection()
            cmdSuccess = true

        elseif sub == "f" or sub == "off" then
            agEnabled = false
            stopAGDetection()
            chat("Anti-grief detection OFF")
            cmdSuccess = true

        elseif sub == "delete" then
            agDetectDelete = not agDetectDelete
            chat("Delete detection: " .. (agDetectDelete and "ON" or "OFF"))
            cmdSuccess = true

        elseif sub == "paint" then
            agDetectPaint = not agDetectPaint
            chat("Paint detection: " .. (agDetectPaint and "ON" or "OFF"))
            cmdSuccess = true

        elseif sub == "anchor" then
            agDetectAnchor = not agDetectAnchor
            chat("Anchor detection: " .. (agDetectAnchor and "ON" or "OFF"))
            cmdSuccess = true

        elseif sub == "spam" then
            agDetectSpam = not agDetectSpam
            chat("Spam detection: " .. (agDetectSpam and "ON" or "OFF"))
            cmdSuccess = true

        elseif sub:match("^cooldown%s+%d+") then
            local val = tonumber(sub:match("^cooldown%s+(%d+)"))
            agCooldownTime = val
            chat("Grief cooldown set to " .. val .. "s")
            cmdSuccess = true

        elseif sub:match("^timefilter%s+%d+") then
            local val = tonumber(sub:match("^timefilter%s+(%d+)"))
            agTimeFilter = val
            chat("Time filter set to " .. val .. "s (0 = everyone)")
            cmdSuccess = true

        elseif sub:match("^ingame") then
            local val = sub:match("^ingame%s+(%a+)")
            agInGame = (val == "t" or val == "on")
            chat("In-game only: " .. (agInGame and "ON" or "OFF"))
            cmdSuccess = true

        elseif sub:match("^enlighten") then
            local val = sub:match("^enlighten%s+(%a+)")
            agEnlighten = (val == "t" or val == "on")
            chat("Enlighten mode: " .. (agEnlighten and "ON" or "OFF"))
            cmdSuccess = true

        elseif sub:match("^whitelist") then
            local action, name = sub:match("^whitelist%s+(%a+)%s+(%S+)")
            if action == "add" and name then
                agWhitelist[name] = true
                chat("Whitelisted: " .. name)
                cmdSuccess = true
            elseif action == "remove" and name then
                agWhitelist[name] = nil
                chat("Removed from whitelist: " .. name)
                cmdSuccess = true
            else
                cmdError = "Use !ag whitelist add/remove [name]"
            end

        else
            chat("Usage: !ag t/f | delete | paint | anchor | spam | cooldown [n] | timefilter [n] | ingame t/f | enlighten t/f | whitelist add/remove [name]")
            cmdSuccess = true
        end
    end

    elseif command == "tp2" then
        if text == "" then
            cmdError = "No target specified"
        else
            pcall(function()
                local target = findPlayerByPartial(text)
                if not target then cmdError = "Target not found" return end
                local myChar     = LocalPlayer.Character
                local targetChar = target.Character
                if myChar and targetChar then
                    local myHRP     = myChar:FindFirstChild("HumanoidRootPart")
                    local targetHRP = targetChar:FindFirstChild("HumanoidRootPart")
                    if myHRP and targetHRP then myHRP.CFrame = targetHRP.CFrame * CFrame.new(0, 0, 3) cmdSuccess = true end
                end
            end)
        end

    elseif command == "fling" then
        if text ~= "" then
            pcall(function() chat(".fling " .. text) cmdSuccess = true end)
        else
            cmdError = "No target specified"
        end

    elseif command == "glaze" or command == "glz" then
        if text ~= "" then pcall(function() chat(text .. " is the best") cmdSuccess = true end) end

    elseif command == "donate" then
        if text ~= "" then pcall(function() chat("donate " .. text) cmdSuccess = true end) end

    elseif command == "dall" then
        pcall(function()
            local timeValue = Players.LocalPlayer.leaderstats.Time.Value
            chat("donate hotdogn.back " .. timeValue)
            cmdSuccess = true
        end)

    elseif command == "credits" then
        pcall(function() chat("Alt Bot V4.5 Private - Hot_Dogn") cmdSuccess = true end)

    elseif command == "reset" then
        pcall(function()
            local character = LocalPlayer.Character
            if character then
                local humanoid = character:FindFirstChildOfClass("Humanoid")
                if humanoid then humanoid.Health = 0 cmdSuccess = true end
            end
        end)

    elseif command == "jump" then
        pcall(function()
            local character = LocalPlayer.Character
            if character then
                local humanoid = character:FindFirstChildOfClass("Humanoid")
                if humanoid then humanoid.Jump = true cmdSuccess = true end
            end
        end)

    elseif command == "spin" then
        pcall(function()
            local speed = tonumber(text)
            if not speed or speed <= 0 then speed = 5 end
            if spinning then spinning = speed cmdSuccess = true return end
            spinning = speed
            task.spawn(function()
                while spinning do
                    local character = LocalPlayer.Character
                    if character then
                        local hrp = character:FindFirstChild("HumanoidRootPart")
                        if hrp then hrp.CFrame = hrp.CFrame * CFrame.Angles(0, math.rad(spinning), 0) end
                    end
                    task.wait(0.03)
                end
            end)
            cmdSuccess = true
        end)

    elseif command == "unspin" then
        spinning = false cmdSuccess = true

    elseif command == "freeze" or command == "fr" then
        pcall(function()
            local character = LocalPlayer.Character
            if character then
                local hrp = character:FindFirstChild("HumanoidRootPart")
                if hrp then hrp.Anchored = true cmdSuccess = true end
            end
        end)

        elseif command == "formation" or command == "form" then
    local parts = {}
    for w in text:gmatch("%S+") do table.insert(parts, w) end
    local sub = (parts[1] or ""):lower()
    local p1, p2  -- numeric parameters

    -- Parse target and parameters
    if #parts >= 2 then
        local potentialTarget = findPlayerByPartial(parts[2])
        if potentialTarget then
            formationTarget = potentialTarget
            p1 = tonumber(parts[3])
            p2 = tonumber(parts[4])
        else
            formationTarget = nil  -- auto-pick
            p1 = tonumber(parts[2])
            p2 = tonumber(parts[3])
        end
    else
        formationTarget = nil
        p1 = nil
        p2 = nil
    end

    local validModes = {
        follow=true, line=true, circle=true, orbit=true, tower=true,
        scatter=true, square=true, diamond=true, grid=true, wall=true,
        triangle=true, pyramid=true, cross=true, wedge=true, arc=true,
        zigzag=true, star=true, spiral=true, heart=true, idle=true,
    }

    if sub == "" or not validModes[sub] then
        chat("Modes: follow line circle orbit tower scatter square diamond grid wall triangle pyramid cross wedge arc zigzag star spiral heart idle")
        cmdSuccess = true
    else
        formationMode = sub

        -- Apply numeric parameters (override defaults)
        if sub == "line"    then LINE_SPACING = p1 or LINE_SPACING;   LINE_DISTANCE  = p2 or LINE_DISTANCE   end
        if sub == "circle"  then CIRCLE_RADIUS = p1 or CIRCLE_RADIUS  end
        if sub == "orbit"   then ORBIT_RADIUS  = p1 or ORBIT_RADIUS;  ORBIT_SPEED    = p2 or ORBIT_SPEED    end
        if sub == "tower"   then TOWER_SPACING  = p1 or TOWER_SPACING; TOWER_DISTANCE = p2 or TOWER_DISTANCE end
        if sub == "scatter" then SCATTER_RADIUS = p1 or SCATTER_RADIUS end
        if sub == "square" or sub == "diamond" or sub == "arc"
            or sub == "star" or sub == "spiral" or sub == "heart" then
            SHAPE_RADIUS  = p1 or SHAPE_RADIUS
            SHAPE_SPACING = p2 or SHAPE_SPACING
        end
        if sub == "grid" or sub == "wall" or sub == "triangle" or sub == "pyramid"
            or sub == "cross" or sub == "wedge" or sub == "zigzag" then
            SHAPE_SPACING  = p1 or SHAPE_SPACING
            SHAPE_DISTANCE = p2 or SHAPE_DISTANCE
        end

        if sub == "idle" then
            formationTarget = nil
            followStuckSince = nil; followStuckCheckPos = nil; lastFollowMoveTo = 0
        end

        local targetName = formationTarget and formationTarget.Name or "auto"
        chat("Formation: " .. sub .. " (target: " .. targetName .. ")")
        cmdSuccess = true
    end

    elseif command == "unfreeze" or command == "ufr" then
        pcall(function()
            local character = LocalPlayer.Character
            if character then
                local hrp = character:FindFirstChild("HumanoidRootPart")
                if hrp then hrp.Anchored = false cmdSuccess = true end
            end
        end)

    elseif command == "dance" or command == "d" then
        pcall(function()
            local hum = LocalPlayer.Character:FindFirstChildOfClass("Humanoid")
            if hum then
                hum.WalkSpeed = 0
                local animator = hum:FindFirstChildOfClass("Animator")
                if animator then
                    local anim = Instance.new("Animation")
                    anim.AnimationId = "rbxassetid://507770239"
                    animator:LoadAnimation(anim):Play()
                    cmdSuccess = true
                end
            end
        end)

    elseif command == "stopdance" or command == "sd" then
        pcall(function()
            local hum = LocalPlayer.Character:FindFirstChildOfClass("Humanoid")
            if hum then
                hum.WalkSpeed = 16
                local animator = hum:FindFirstChildOfClass("Animator")
                if animator then
                    for _, track in ipairs(animator:GetPlayingAnimationTracks()) do track:Stop() end
                    cmdSuccess = true
                end
            end
        end)

    elseif command == "autodall" then
        if text:lower() == "t" or text:lower() == "on" then
            pcall(function()
                local timeValue = LocalPlayer.leaderstats.Time.Value
                chat(";donate " .. autoDallTarget .. " " .. timeValue)
            end)
            autoDallEnabled = true
            chat("Auto-dall enabled")
            cmdSuccess = true
        elseif text:lower() == "f" or text:lower() == "off" then
            autoDallEnabled = false
            chat("Auto-dall disabled")
            cmdSuccess = true
        else
            cmdError = "Use !autodall t or !autodall f"
        end

    elseif command == "rejoin" or command == "rj" then
        pcall(function()
            queue_on_teleport(game:HttpGet("https://raw.githubusercontent.com/Ali-droidlol/BlacklistTCO/refs/heads/main/BotScript"))
            task.wait(0.5)
            TeleportService:Teleport(game.PlaceId, LocalPlayer)
            cmdSuccess = true
        end)

    elseif command == "antiafk" then
        if text:lower() == "t" or text:lower() == "on" then
            antiafk = true chat("Anti-AFK enabled")
        elseif text:lower() == "f" or text:lower() == "off" then
            antiafk = false chat("Anti-AFK disabled")
        else
            antiafk = not antiafk
            chat("Anti-AFK " .. (antiafk and "enabled" or "disabled"))
        end
        cmdSuccess = true

    elseif command == "stop" then
        spinning = false
        following = false
        followTarget = nil
        autoR6 = false
        antiafk = false
        blacklistEnabled = false
        pollerRunning = false
        autoDallEnabled = false
        scriptRunning = false
        StopBuild()
        stopBkitCrash()
        agEnabled = false
        stopAGDetection()
        griefAuraActive = false
        unanchorAuraActive = false
        sprayAuraActive = false
		tempAdmins = {}
		commandPrefix = "!"
        formationMode = "idle"
        formationTarget = nil
        followStuckSince = nil; followStuckCheckPos = nil; lastFollowMoveTo = 0

        if scriptConnection then
            scriptConnection:Disconnect()
            scriptConnection = nil
        end

        _G.BotScriptLoaded = nil
        chat("Bot stopped.")
        cmdSuccess = true

    elseif command == "follow" or command == "fl" then
        if text == "" then
            cmdError = "No target specified"
        else
            pcall(function()
                local target = findPlayerByPartial(text)
                if not target then cmdError = "Target not found" return end
                followTarget = target following = true cmdSuccess = true
            end)
        end

    elseif command == "unfollow" or command == "ufl" then
        following = false followTarget = nil cmdSuccess = true

    elseif command == "autor6" then
        if text:lower() == "t" then
            pcall(function()
                local character = LocalPlayer.Character
                local backpack  = LocalPlayer:FindFirstChild("Backpack")
                if not character or not backpack then cmdError = "Character or backpack not found" return end
                local humanoid   = character:FindFirstChildOfClass("Humanoid")
                local arkenstone = character:FindFirstChild("The Arkenstone") or backpack:FindFirstChild("The Arkenstone")
                if not arkenstone then cmdError = "The Arkenstone not found" return end
                if arkenstone.Parent == backpack then humanoid:EquipTool(arkenstone) task.wait(0.5) end
                chat(";r6 a")
                task.wait(0.5)
                autoR6 = true cmdSuccess = true
            end)
        elseif text:lower() == "f" then
            autoR6 = false cmdSuccess = true
        end

    elseif command == "quickvamp" or command == "qv" then
        if text == "" then
            cmdError = "No target specified"
        else
            pcall(function()
                local target    = findPlayerByPartial(text)
                if not target then cmdError = "Target not found" return end
                local character = LocalPlayer.Character
                local backpack  = LocalPlayer:FindFirstChild("Backpack")
                if not character or not backpack then cmdError = "Character or backpack not found" return end
                local humanoid = character:FindFirstChildOfClass("Humanoid")
                local vamp     = character:FindFirstChild("VampireVanquisher") or backpack:FindFirstChild("VampireVanquisher")
                if not vamp then
                    local arkenstone = character:FindFirstChild("The Arkenstone") or backpack:FindFirstChild("The Arkenstone")
                    if arkenstone then
                        if arkenstone.Parent == backpack then humanoid:EquipTool(arkenstone) task.wait(0.5) end
                        chat(";gear me 94794847")
                        task.wait(1)
                    else
                        cmdError = "The Arkenstone not found" return
                    end
                end
                local arkenstone = character:FindFirstChild("The Arkenstone") or backpack:FindFirstChild("The Arkenstone")
                if arkenstone then
                    if arkenstone.Parent == backpack then humanoid:EquipTool(arkenstone) task.wait(0.5) end
                    chat(";ff a")   task.wait(0.5)
                    chat(";god a")  task.wait(0.5)
                    chat(";unff "  .. target.Name) task.wait(0.5)
                    chat(";ungod " .. target.Name) task.wait(0.5)
                end
                vamp = character:FindFirstChild("VampireVanquisher") or backpack:FindFirstChild("VampireVanquisher")
                if not vamp then cmdError = "VampireVanquisher not found" return end
                if vamp.Parent == backpack then humanoid:EquipTool(vamp) task.wait(0.3) end
                local elapsed = 0
                task.spawn(function()
                    while elapsed < 10 do
                        local myChar     = LocalPlayer.Character
                        local targetChar = target.Character
                        if not myChar or not targetChar then break end
                        local targetHumanoid = targetChar:FindFirstChildOfClass("Humanoid")
                        if not targetHumanoid or targetHumanoid.Health <= 0 then break end
                        local myHRP     = myChar:FindFirstChild("HumanoidRootPart")
                        local targetHRP = targetChar:FindFirstChild("HumanoidRootPart")
                        if myHRP and targetHRP then myHRP.CFrame = targetHRP.CFrame * CFrame.new(0, 0, 2) end
                        task.wait(0.1)
                        elapsed = elapsed + 0.1
                    end
                end)
                cmdSuccess = true
            end)
        end

    elseif command == "disablebkit" or command == "dbk" then
        pcall(function()
            local character  = LocalPlayer.Character
            local backpack   = LocalPlayer:FindFirstChild("Backpack")
            if not character or not backpack then cmdError = "Character or backpack not found" return end
            local humanoid   = character:FindFirstChildOfClass("Humanoid")
            local deleteTool = character:FindFirstChild("Delete") or backpack:FindFirstChild("Delete")
            if deleteTool then
                if deleteTool.Parent == backpack then humanoid:EquipTool(deleteTool) task.wait(0.5) end
                local dtool = character:FindFirstChild("Delete")
                if dtool and dtool:FindFirstChild("Script") then
                    dtool.Script.Event:FireServer(game.ReplicatedStorage.Brick, character.HumanoidRootPart.Position)
                    cmdSuccess = true
                end
            else
                cmdError = "Delete tool not found"
            end
        end)

    elseif command == "servershutdown" or command == "ssh" then
        pcall(function()
            local character  = LocalPlayer.Character
            local backpack   = LocalPlayer:FindFirstChild("Backpack")
            if not character or not backpack then cmdError = "Character or backpack not found" return end
            local humanoid   = character:FindFirstChildOfClass("Humanoid")
            local deleteTool = character:FindFirstChild("Delete") or backpack:FindFirstChild("Delete")
            if deleteTool then
                if deleteTool.Parent == backpack then humanoid:EquipTool(deleteTool) task.wait(0.5) end
                local dtool = character:FindFirstChild("Delete")
                if dtool and dtool:FindFirstChild("Script") then
                    dtool.Script.Event:FireServer(game.ReplicatedStorage.Brick, character.HumanoidRootPart.Position)
                end
            else
                local arkenstone = character:FindFirstChild("The Arkenstone") or backpack:FindFirstChild("The Arkenstone")
                if arkenstone then
                    if arkenstone.Parent == backpack then humanoid:EquipTool(arkenstone) task.wait(0.5) end
                    chat(";bkit me") task.wait(1)
                else
                    cmdError = "The Arkenstone not found" return
                end
            end
            local arkenstone = character:FindFirstChild("The Arkenstone") or backpack:FindFirstChild("The Arkenstone")
            if arkenstone then
                if arkenstone.Parent == backpack then humanoid:EquipTool(arkenstone) task.wait(0.5) end
                chat("delcubes a") task.wait(1)
                chat("maptide nan") task.wait(0.5)
                chat("reset o")
                cmdSuccess = true
            end
        end)
    end

    sendWebhookLog(player.Name, command, text, cmdSuccess, cmdError)
end

-- ==========================================
-- BOOT
-- ==========================================
task.spawn(function()
    chatChannel = TextChatService.TextChannels:WaitForChild("RBXGeneral", 10)

    if not chatChannel then
        warn("RBXGeneral not found — falling back to legacy chat")
    end

    chat("script loading Credits to HOT_DOGN -- Alt Bot Private")

    pcall(function()
        loadstring(game:HttpGet("https://raw.githubusercontent.com/FilteringEnabled/NamelessAdmin/main/Source"))()
    end)

    if chatChannel then
        scriptConnection = chatChannel.MessageReceived:Connect(handleMessage)
    else
        warn("Commands disabled — RBXGeneral unavailable")
    end
end)

-- ==========================================
-- GITHUB POLLER
-- ==========================================
task.spawn(function()
    while task.wait(0.5) do
        if not pollerRunning then break end

        local ok, res = pcall(function()
            return request({
                Url     = GITHUB_COMMAND_URL,
                Method  = "GET",
                Headers = {
                    ["Cache-Control"] = "no-cache",
                    ["Pragma"]        = "no-cache"
                }
            })
        end)

        if not ok or not res then continue end

        local body = res.Body or res.body
        if not body or body == "" then continue end

        local ok2, data = pcall(function() return HttpService:JSONDecode(body) end)
        if not ok2 or not data then continue end
        if type(data.id) ~= "number" then continue end

        if lastCommandId == nil then
            lastCommandId = data.id
            print("Synced command ID:", data.id)
            continue
        end

        if data.id == lastCommandId then continue end

        lastCommandId = data.id
        print("Executing command:", data.command)
        handleMessage(nil, true, data.command)
    end

    print("Poller stopped.")
end)

Features & Information

Tutorial https://docs.google.com/document/d/1zFk9kAptbRjbjidBlxqpyLu0mSv5GNCEX9OUOWIi1J0/edit?usp=sharing hotdogns bot source leak 100% ai so like (edit to use)
#The Chosen One#BOT#bot

Community Comments (0)

No comments yet for this script.

More Scripts for The Chosen One