game component viewer
Key RequiredUniversal

game component viewer

Universal Scripthey24115hey24115 267 views 59 executesUpdated Jun 22, 2026
Unrated
00
Lua Script•376 lines (11965 chars)
-- Roblox Script: Hierarchy Explorer - MINIMAL WORKING VERSION
-- No fancy UI, just pure functionality. Click folders to expand. Click scripts to copy.
-- Uses simple text buttons with clear contrast.

local screenGui = Instance.new("ScreenGui")
screenGui.Name = "HierarchyViewer"
screenGui.Parent = game.CoreGui
screenGui.ResetOnSpawn = false

local mainFrame = Instance.new("Frame")
mainFrame.Size = UDim2.new(0, 500, 0, 600)
mainFrame.Position = UDim2.new(0.5, -250, 0.5, -300)
mainFrame.BackgroundColor3 = Color3.fromRGB(20, 20, 30)
mainFrame.BackgroundTransparency = 0
mainFrame.BorderSizePixel = 2
mainFrame.BorderColor3 = Color3.fromRGB(100, 150, 255)
mainFrame.Parent = screenGui

local title = Instance.new("TextLabel")
title.Size = UDim2.new(1, 0, 0, 30)
title.Position = UDim2.new(0, 0, 0, 0)
title.BackgroundColor3 = Color3.fromRGB(40, 50, 80)
title.Text = "HIERARCHY VIEWER - Click folder to expand, script to copy"
title.TextColor3 = Color3.fromRGB(255, 255, 255)
title.Font = Enum.Font.SourceSansBold
title.TextSize = 14
title.Parent = mainFrame

local closeBtn = Instance.new("TextButton")
closeBtn.Size = UDim2.new(0, 40, 0, 30)
closeBtn.Position = UDim2.new(1, -40, 0, 0)
closeBtn.BackgroundColor3 = Color3.fromRGB(200, 40, 40)
closeBtn.Text = "X"
closeBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
closeBtn.Font = Enum.Font.SourceSansBold
closeBtn.TextSize = 16
closeBtn.Parent = mainFrame
closeBtn.MouseButton1Click:Connect(function() screenGui:Destroy() end)

local scrollFrame = Instance.new("ScrollingFrame")
scrollFrame.Size = UDim2.new(1, -10, 1, -40)
scrollFrame.Position = UDim2.new(0, 5, 0, 35)
scrollFrame.BackgroundColor3 = Color3.fromRGB(10, 10, 20)
scrollFrame.BackgroundTransparency = 0
scrollFrame.BorderSizePixel = 1
scrollFrame.BorderColor3 = Color3.fromRGB(50, 50, 80)
scrollFrame.CanvasSize = UDim2.new(0, 0, 0, 0)
scrollFrame.ScrollBarThickness = 8
scrollFrame.Parent = mainFrame

local copyBtn = Instance.new("TextButton")
copyBtn.Size = UDim2.new(0, 120, 0, 28)
copyBtn.Position = UDim2.new(0.5, -60, 0, 0)
copyBtn.BackgroundColor3 = Color3.fromRGB(30, 100, 200)
copyBtn.Text = "📋 COPY ALL"
copyBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
copyBtn.Font = Enum.Font.SourceSansBold
copyBtn.TextSize = 12
copyBtn.Visible = false
copyBtn.Parent = title

local statusLabel = Instance.new("TextLabel")
statusLabel.Size = UDim2.new(0.5, 0, 0, 20)
statusLabel.Position = UDim2.new(0.25, 0, 1, -22)
statusLabel.BackgroundTransparency = 1
statusLabel.Text = ""
statusLabel.TextColor3 = Color3.fromRGB(100, 255, 100)
statusLabel.Font = Enum.Font.SourceSans
statusLabel.TextSize = 12
statusLabel.TextXAlignment = Enum.TextXAlignment.Center
statusLabel.Parent = mainFrame

local rootNodes = {}
local allButtons = {}
local totalScripts = 0
local lineHeight = 24

-- COPY FUNCTION - SIMPLE
local function copyText(text)
    local success = false
    
    -- Try all methods
    pcall(function() 
        local c = Instance.new("Clipboard")
        c:SetText(text)
        c:Destroy()
        success = true
    end)
    
    if not success then
        pcall(function() 
            game:GetService("UserInputService"):SetClipboard(text)
            success = true
        end)
    end
    
    if not success then
        pcall(function() setclipboard(text) success = true end)
    end
    
    if not success then
        pcall(function() toclipboard(text) success = true end)
    end
    
    -- Fallback: show in a textbox
    if not success then
        local box = Instance.new("TextBox")
        box.Size = UDim2.new(0, 480, 0, 300)
        box.Position = UDim2.new(0.5, -240, 0.5, -150)
        box.BackgroundColor3 = Color3.fromRGB(30, 30, 50)
        box.TextColor3 = Color3.fromRGB(255, 255, 255)
        box.Text = text
        box.MultiLine = true
        box.Font = Enum.Font.SourceSans
        box.TextSize = 11
        box.Parent = screenGui
        box:CaptureFocus()
        box:SelectAll()
        statusLabel.Text = "📋 Text shown in box - press Ctrl+C"
        statusLabel.TextColor3 = Color3.fromRGB(255, 255, 100)
        task.delay(8, function() box:Destroy() end)
        return
    end
    
    statusLabel.Text = "✅ Copied!"
    statusLabel.TextColor3 = Color3.fromRGB(100, 255, 100)
    task.delay(2, function() statusLabel.Text = "" end)
end

-- Build tree
local function buildTree(instance, depth, parentNode)
    depth = depth or 0
    local nodes = {}
    local children = instance:GetChildren()
    
    for i = 1, #children do
        local child = children[i]
        local isScript = child:IsA("Script") or child:IsA("LocalScript") or child:IsA("ModuleScript")
        local hasScripts = false
        
        if not isScript then
            local function check(obj)
                for _, c in ipairs(obj:GetChildren()) do
                    if c:IsA("Script") or c:IsA("LocalScript") or c:IsA("ModuleScript") then
                        return true
                    end
                    if check(c) then return true end
                end
                return false
            end
            hasScripts = check(child)
        end
        
        if isScript or hasScripts then
            local node = {
                obj = child,
                depth = depth,
                parent = parentNode,
                children = {},
                expanded = false,
                isScript = isScript,
                path = "game." .. child:GetFullName(),
            }
            
            local childNodes = buildTree(child, depth + 1, node)
            node.children = childNodes
            
            if isScript then
                totalScripts = totalScripts + 1
            end
            
            table.insert(nodes, node)
        end
        
        if i % 200 == 0 then
            task.wait()
        end
    end
    
    return nodes
end

-- Get directory text
local function getDirText(node, depth, lines)
    depth = depth or 0
    lines = lines or {}
    local indent = string.rep("  ", depth)
    local icon = node.isScript and "[SCRIPT]" or "[FOLDER]"
    local parentName = node.parent and node.parent.obj.Name or "ROOT"
    local line = indent .. icon .. " " .. node.obj.Name .. " | Parent: " .. parentName .. " | Path: " .. node.path
    table.insert(lines, line)
    for _, child in ipairs(node.children) do
        getDirText(child, depth + 1, lines)
    end
    return lines
end

-- Render nodes
local function renderNodes()
    for _, btn in ipairs(allButtons) do
        btn:Destroy()
    end
    allButtons = {}
    
    local yOff = 4
    local filter = ""
    
    local function renderNode(node)
        local indent = string.rep("  ", node.depth)
        local icon = node.expanded and "▼ " or "▶ "
        local typeIcon = node.isScript and "📄 " or "📁 "
        local name = node.obj.Name
        if not node.isScript and #node.children > 0 then
            name = name .. " (" .. #node.children .. ")"
        end
        local text = indent .. icon .. typeIcon .. name
        
        local btn = Instance.new("TextButton")
        btn.Size = UDim2.new(1, -20, 0, lineHeight)
        btn.Position = UDim2.new(0, 10, 0, yOff)
        btn.BackgroundColor3 = node.isScript and Color3.fromRGB(50, 60, 120) or Color3.fromRGB(40, 40, 70)
        btn.TextColor3 = Color3.fromRGB(255, 255, 255)
        btn.Text = text
        btn.TextXAlignment = Enum.TextXAlignment.Left
        btn.TextSize = 13
        btn.Font = Enum.Font.SourceSans
        btn.BorderSizePixel = 1
        btn.BorderColor3 = Color3.fromRGB(80, 100, 180)
        btn.Parent = scrollFrame
        table.insert(allButtons, btn)
        
        btn.MouseButton1Click:Connect(function()
            if node.isScript then
                copyText(node.path)
                local old = btn.Text
                btn.Text = "✅ " .. node.path
                btn.TextColor3 = Color3.fromRGB(100, 255, 100)
                task.wait(1)
                btn.Text = old
                btn.TextColor3 = Color3.fromRGB(255, 255, 255)
            else
                node.expanded = not node.expanded
                renderNodes()
            end
        end)
        
        btn.TouchTap:Connect(function()
            if node.isScript then
                copyText(node.path)
                local old = btn.Text
                btn.Text = "✅ " .. node.path
                btn.TextColor3 = Color3.fromRGB(100, 255, 100)
                task.wait(1)
                btn.Text = old
                btn.TextColor3 = Color3.fromRGB(255, 255, 255)
            else
                node.expanded = not node.expanded
                renderNodes()
            end
        end)
        
        yOff = yOff + lineHeight
        
        if node.expanded then
            for _, child in ipairs(node.children) do
                renderNode(child)
            end
        end
    end
    
    for _, node in ipairs(rootNodes) do
        renderNode(node)
    end
    
    scrollFrame.CanvasSize = UDim2.new(0, 0, 0, yOff + 10)
    
    -- Update title with count
    title.Text = "HIERARCHY (" .. totalScripts .. " scripts) - Click folder to expand, script to copy"
end

-- Build everything
local function buildEverything()
    rootNodes = {}
    allButtons = {}
    totalScripts = 0
    
    local loadLabel = Instance.new("TextLabel")
    loadLabel.Size = UDim2.new(1, -20, 0, 30)
    loadLabel.Position = UDim2.new(0, 10, 0, 10)
    loadLabel.BackgroundTransparency = 1
    loadLabel.Text = "Loading hierarchy..."
    loadLabel.TextColor3 = Color3.fromRGB(255, 255, 200)
    loadLabel.Font = Enum.Font.SourceSans
    loadLabel.TextSize = 14
    loadLabel.Parent = scrollFrame
    
    task.wait(0.1)
    
    local success, err = pcall(function()
        local services = {
            game.Workspace,
            game.Players,
            game.Lighting,
            game.ReplicatedStorage,
            game.ServerScriptService,
            game.ServerStorage,
            game.StarterGui,
            game.StarterPack,
            game.StarterPlayer,
            game.ReplicatedFirst,
            game.SoundService,
            game.Teams,
        }
        
        for _, svc in ipairs(services) do
            if svc then
                local nodes = buildTree(svc, 0, nil)
                for _, n in ipairs(nodes) do
                    table.insert(rootNodes, n)
                end
            end
        end
    end)
    
    loadLabel:Destroy()
    
    if not success then
        local errLabel = Instance.new("TextLabel")
        errLabel.Size = UDim2.new(1, -20, 0, 30)
        errLabel.Position = UDim2.new(0, 10, 0, 10)
        errLabel.BackgroundTransparency = 1
        errLabel.Text = "Error: " .. tostring(err)
        errLabel.TextColor3 = Color3.fromRGB(255, 150, 150)
        errLabel.Font = Enum.Font.SourceSans
        errLabel.TextSize = 14
        errLabel.Parent = scrollFrame
        return
    end
    
    -- Expand first level
    for _, node in ipairs(rootNodes) do
        node.expanded = true
    end
    
    renderNodes()
end

-- Copy ALL button
local copyAllBtn = Instance.new("TextButton")
copyAllBtn.Size = UDim2.new(0, 130, 0, 28)
copyAllBtn.Position = UDim2.new(0.5, -65, 0, 0)
copyAllBtn.BackgroundColor3 = Color3.fromRGB(30, 100, 200)
copyAllBtn.Text = "📋 COPY ALL"
copyAllBtn.TextColor3 = Color3.fromRGB(255, 255, 255)
copyAllBtn.Font = Enum.Font.SourceSansBold
copyAllBtn.TextSize = 12
copyAllBtn.BorderSizePixel = 0
copyAllBtn.Parent = title

copyAllBtn.MouseButton1Click:Connect(function()
    local lines = {}
    table.insert(lines, "=== FULL HIERARCHY ===")
    table.insert(lines, "Scripts: " .. totalScripts)
    table.insert(lines, "")
    for _, node in ipairs(rootNodes) do
        local dirLines = getDirText(node, 0, {})
        for _, l in ipairs(dirLines) do
            table.insert(lines, l)
        end
        table.insert(lines, "")
    end
    copyText(table.concat(lines, "\n"))
end)

-- Start
buildEverything()

Features & Information

It's a script which gives you access to ingame viewing of the components. Pretty useful for a genuine basis of reference if you're scripting. If you're a skid get outta here ts ain't for u😂
#Independent#Universal#Global#Notforskids#Help

Community Comments (1)

ts_pmots_pmoAug 21, 2026

i Skidded Vampire Infection with ts

More Scripts for Universal Scripts