inventory viewer
Key Required

inventory viewer

BlockSpin 🔪 [MANSION UNDERGROUND]oz49oz49 12.2K views 33.6K executesUpdated Oct 25, 2025
2.5/ 5(2 votes)
1150% Positive
Lua Script•778 lines (31683 chars)
local TeleportService = game:GetService("TeleportService")
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer







local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local StarterPack = game:GetService("StarterPack")
local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local CoreGuiService = game:GetService("CoreGui")
local TweenService = game:GetService("TweenService")
local CoreGui = type(cloneref) == "function" and cloneref(CoreGuiService) or CoreGuiService

local NameCache = {}
local selected, currentKeybind, isDraggable, settingsFrame, inventoryConnection, isSettingKey = nil, Enum.KeyCode.Y, false, nil, nil, false
local keybindButton = nil
local activeESP = {}
local activeDistance = {}
local backButton = nil
local currentTab = "Tools"

local function generateName()
    local name = NameCache[#NameCache] or string.char(math.random(65,90))..string.char(math.random(97,122))..tostring(math.random(100,999))
    table.insert(NameCache, name)
    return name
end

local gui = Instance.new("ScreenGui", CoreGui)
gui.Name = generateName()
gui.IgnoreGuiInset = true
gui.DisplayOrder = 1000

local isMobile = UserInputService.TouchEnabled
local pcSize, pcPos = UDim2.new(0, 400, 0, 450), UDim2.new(0, 20, 0.5, -225)
local mobSize, mobPos = UDim2.new(0, 240, 0, 230), UDim2.new(0, 17, 0.5, -115)

local frame = Instance.new("Frame", gui)
frame.Name = generateName()
frame.Size = isMobile and mobSize or pcSize
frame.Position = isMobile and mobPos or pcPos
frame.BackgroundColor3 = Color3.fromRGB(15, 15, 25)
frame.ClipsDescendants = true
Instance.new("UICorner", frame).CornerRadius = UDim.new(0, 15)
local stroke = Instance.new("UIStroke", frame)
stroke.Color = Color3.fromRGB(80, 60, 200)
stroke.Thickness = 2

local gradient = Instance.new("UIGradient", frame)
gradient.Color = ColorSequence.new({
    ColorSequenceKeypoint.new(0, Color3.fromRGB(20, 15, 35)),
    ColorSequenceKeypoint.new(1, Color3.fromRGB(5, 5, 15))
})

local header = Instance.new("Frame", frame)
header.Size = UDim2.new(1, 0, 0, 40)
header.BackgroundColor3 = Color3.fromRGB(25, 20, 40)
local headerCorner = Instance.new("UICorner", header)
headerCorner.CornerRadius = UDim.new(0, 15)

local headerMask = Instance.new("Frame", header)
headerMask.Size = UDim2.new(1, 0, 0, 20)
headerMask.Position = UDim2.new(0, 0, 1, -20)
headerMask.BackgroundColor3 = Color3.fromRGB(25, 20, 40)
headerMask.BorderSizePixel = 0

local settingsButton = Instance.new("ImageButton", header)
settingsButton.Size = UDim2.new(0, 30, 0, 30)
settingsButton.Position = UDim2.new(0, 8, 0.5, -15)
settingsButton.Image = "rbxassetid://4859271243"
settingsButton.BackgroundTransparency = 1
settingsButton.ImageColor3 = Color3.fromRGB(200, 200, 255)

local title = Instance.new("TextLabel", header)
title.Font = Enum.Font.GothamBold
title.TextSize = 15
title.TextScaled = true
title.TextColor3 = Color3.fromRGB(255, 255, 255)
title.Size = UDim2.new(1, -120, 1, 0)
title.Position = UDim2.new(0.5, -10, 0, 0)
title.AnchorPoint = Vector2.new(0.5, 0)
title.BackgroundTransparency = 1
title.Text = "Select Player"

local close = Instance.new("TextButton", header)
close.Size = UDim2.new(0, 35, 0, 35)
close.Position = UDim2.new(1, -43, 0.5, -17.5)
close.Text = "X"
close.Font = Enum.Font.GothamBold
close.TextSize = 25
close.TextColor3 = Color3.fromRGB(255, 100, 100)
close.BackgroundColor3 = Color3.fromRGB(50, 25, 40)
Instance.new("UICorner", close).CornerRadius = UDim.new(0, 8)

local scroll = Instance.new("ScrollingFrame", frame)
scroll.Size = UDim2.new(1, -20, 1, -60)
scroll.Position = UDim2.new(0, 10, 0, 50)
scroll.BackgroundTransparency = 1
scroll.AutomaticCanvasSize = Enum.AutomaticSize.Y
scroll.ScrollBarThickness = 8
scroll.ScrollBarImageColor3 = Color3.fromRGB(100, 80, 200)

local layout = Instance.new("UIListLayout", scroll)
layout.SortOrder = Enum.SortOrder.LayoutOrder
layout.Padding = UDim.new(0, 8)

local function getToolTexture(tool)
    if not tool then return "rbxassetid://4483345998" end
    if typeof(tool.TextureId) == "string" and tool.TextureId ~= "" then return tool.TextureId end
    if tool:GetAttribute("ImageId") then return tool:GetAttribute("ImageId") end
    local handle = tool:FindFirstChild("Handle")
    if handle then
        if handle:IsA("MeshPart") and handle.TextureID ~= "" then return handle.TextureID end
        for _, decal in ipairs(handle:GetChildren()) do
            if decal:IsA("Decal") and decal.Texture ~= "" then return decal.Texture end
        end
    end
    return "rbxassetid://4483345998"
end

local function getRarityColor(rarity)
    local colors = {
        Common = Color3.fromRGB(0, 255, 0),
        Rare = Color3.fromRGB(0, 0, 255),
        Epic = Color3.fromRGB(128, 0, 128),
        Legendary = Color3.fromRGB(255, 215, 0),
        Uncommon = Color3.fromRGB(128, 128, 128)
    }
    return colors[rarity] or Color3.fromRGB(128, 128, 128)
end

local function matchToolName(tool)
    if not tool then return "Unknown", getToolTexture(nil) end
    local handle = tool:FindFirstChild("Handle")
    if not handle then return tool.Name, getToolTexture(tool) end
    local names = {}
    for _, child in ipairs(handle:GetChildren()) do names[child.Name] = true end
    for _, source in ipairs({ReplicatedStorage:FindFirstChild("Items"), StarterPack}) do
        if source then
            for _, item in ipairs(source:GetDescendants()) do
                if item:IsA("Tool") and item:FindFirstChild("Handle") then
                    local matches = true
                    for name in pairs(names) do
                        if not item.Handle:FindFirstChild(name) then matches = false break end
                    end
                    if matches then return item.Name, getToolTexture(item) end
                end
            end
        end
    end
    return tool.Name, getToolTexture(tool)
end

local function getPlayerTools(player)
    local tools = {}
    if not player then return tools end
    for _, container in ipairs({player.Backpack, player.Character}) do
        if container then
            for _, tool in ipairs(container:GetChildren()) do
                if tool:IsA("Tool") then 
                    table.insert(tools, tool)
                end
            end
        end
    end
    return tools
end

local function clearScrollContent()
    for _, child in ipairs(scroll:GetChildren()) do
        if child:IsA("GuiObject") and child ~= layout then child:Destroy() end
    end
end

local function createESP(player)
    if not player then return end
    local character = player.Character
    if not character then return end
    local head = character:FindFirstChild("Head")
    if not head then return end
    
    local billboard = Instance.new("BillboardGui", head)
    billboard.Size = UDim2.new(0, 200, 0, 50)
    billboard.StudsOffset = Vector3.new(0, 2, 0)
    billboard.AlwaysOnTop = true
    billboard.Name = "UsernameESP"
    
    local background = Instance.new("Frame", billboard)
    background.Size = UDim2.new(0, 0, 0, 25)
    background.Position = UDim2.new(0.5, 0, 0.5, 0)
    background.AnchorPoint = Vector2.new(0.5, 0.5)
    background.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
    background.BackgroundTransparency = 0.3
    Instance.new("UICorner", background).CornerRadius = UDim.new(0, 5)
    
    local label = Instance.new("TextLabel", background)
    label.Size = UDim2.new(1, -10, 1, 0)
    label.Position = UDim2.new(0, 5, 0, 0)
    label.BackgroundTransparency = 1
    label.Font = Enum.Font.GothamBold
    label.TextSize = 14
    label.TextColor3 = Color3.fromRGB(255, 255, 255)
    label.Text = player.DisplayName
    label.TextXAlignment = Enum.TextXAlignment.Center
    
    local textSize = game:GetService("TextService"):GetTextSize(player.DisplayName, 14, Enum.Font.GothamBold, Vector2.new(200, 25))
    background.Size = UDim2.new(0, textSize.X + 20, 0, 25)
    
    activeESP[player.Name] = billboard
end

local function createDistanceDisplay(player)
    if not player then return end
    local character = player.Character
    if not character then return end
    local rootPart = character:FindFirstChild("HumanoidRootPart")
    if not rootPart then return end
    
    local billboard = Instance.new("BillboardGui", rootPart)
    billboard.Size = UDim2.new(0, 200, 0, 30)
    billboard.StudsOffset = Vector3.new(0, -3, 0)
    billboard.AlwaysOnTop = true
    billboard.Name = "DistanceESP"
    
    local background = Instance.new("Frame", billboard)
    background.Size = UDim2.new(0, 0, 0, 20)
    background.Position = UDim2.new(0.5, 0, 0.5, 0)
    background.AnchorPoint = Vector2.new(0.5, 0.5)
    background.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
    background.BackgroundTransparency = 0.3
    Instance.new("UICorner", background).CornerRadius = UDim.new(0, 5)
    
    local label = Instance.new("TextLabel", background)
    label.Size = UDim2.new(1, -10, 1, 0)
    label.Position = UDim2.new(0, 5, 0, 0)
    label.BackgroundTransparency = 1
    label.Font = Enum.Font.GothamBold
    label.TextSize = 12
    label.TextColor3 = Color3.fromRGB(255, 255, 255)
    label.Text = "0 studs"
    label.TextXAlignment = Enum.TextXAlignment.Center
    
    local connection
    connection = RunService.Heartbeat:Connect(function()
        local localPlayer = Players.LocalPlayer
        if not localPlayer.Character or not localPlayer.Character:FindFirstChild("HumanoidRootPart") or not character.Parent or not rootPart.Parent then
            billboard:Destroy()
            connection:Disconnect()
            activeDistance[player.Name] = nil
            return
        end
        local distance = (localPlayer.Character.HumanoidRootPart.Position - rootPart.Position).Magnitude
        label.Text = string.format("%.1f studs", distance)
        local textSize = game:GetService("TextService"):GetTextSize(label.Text, 12, Enum.Font.GothamBold, Vector2.new(200, 20))
        background.Size = UDim2.new(0, textSize.X + 20, 0, 20)
    end)
    
    activeDistance[player.Name] = billboard
end

local function toggleUsernameESP(player, enable)
    if not player then return end
    if enable then
        if activeESP[player.Name] then return end
        if player.Character then createESP(player) end
        player.CharacterAdded:Connect(function() createESP(player) end)
    else
        if activeESP[player.Name] then
            activeESP[player.Name]:Destroy()
            activeESP[player.Name] = nil
        end
    end
end

local function toggleDistanceDisplay(player, enable)
    if not player then return end
    if enable then
        if activeDistance[player.Name] then return end
        if player.Character then createDistanceDisplay(player) end
        player.CharacterAdded:Connect(function() createDistanceDisplay(player) end)
    else
        if activeDistance[player.Name] then
            activeDistance[player.Name]:Destroy()
            activeDistance[player.Name] = nil
        end
    end
end

local function createKeybindSettings()
    if settingsFrame then settingsFrame:Destroy() end
    
    settingsFrame = Instance.new("Frame", frame)
    settingsFrame.Size = UDim2.new(1, -20, 0, 150)
    settingsFrame.Position = UDim2.new(0, 10, 0, 50)
    settingsFrame.BackgroundColor3 = Color3.fromRGB(20, 15, 30)
    settingsFrame.Visible = false
    Instance.new("UICorner", settingsFrame).CornerRadius = UDim.new(0, 10)
    
    local keybindLabel = Instance.new("TextLabel", settingsFrame)
    keybindLabel.Size = UDim2.new(1, -20, 0, 25)
    keybindLabel.Position = UDim2.new(0, 10, 0, 10)
    keybindLabel.BackgroundTransparency = 1
    keybindLabel.Font = Enum.Font.Gotham
    keybindLabel.TextSize = 14
    keybindLabel.TextColor3 = Color3.fromRGB(200, 200, 255)
    keybindLabel.Text = "Keybind: " .. currentKeybind.Name
    keybindLabel.TextXAlignment = Enum.TextXAlignment.Left
    
    keybindButton = Instance.new("TextButton", settingsFrame)
    keybindButton.Size = UDim2.new(0, 120, 0, 30)
    keybindButton.Position = UDim2.new(0, 10, 0, 40)
    keybindButton.BackgroundColor3 = Color3.fromRGB(60, 40, 120)
    keybindButton.Font = Enum.Font.Gotham
    keybindButton.TextSize = 14
    keybindButton.TextColor3 = Color3.fromRGB(255, 255, 255)
    keybindButton.Text = "Change Keybind"
    Instance.new("UICorner", keybindButton).CornerRadius = UDim.new(0, 8)
    
    local dragLabel = Instance.new("TextLabel", settingsFrame)
    dragLabel.Size = UDim2.new(1, -20, 0, 25)
    dragLabel.Position = UDim2.new(0, 10, 0, 90)
    dragLabel.BackgroundTransparency = 1
    dragLabel.Font = Enum.Font.Gotham
    dragLabel.TextSize = 14
    dragLabel.TextColor3 = Color3.fromRGB(200, 200, 255)
    dragLabel.Text = "Drag UI: " .. (isDraggable and "ON" or "OFF")
    dragLabel.TextXAlignment = Enum.TextXAlignment.Left
    
    local dragToggleButton = Instance.new("TextButton", settingsFrame)
    dragToggleButton.Size = UDim2.new(0, 50, 0, 25)
    dragToggleButton.Position = UDim2.new(1, -60, 0, 90)
    dragToggleButton.BackgroundColor3 = Color3.fromRGB(40, 40, 60)
    dragToggleButton.Text = ""
    dragToggleButton.AutoButtonColor = false
    Instance.new("UICorner", dragToggleButton).CornerRadius = UDim.new(0, 12)
    
    local dragToggleInner = Instance.new("Frame", dragToggleButton)
    dragToggleInner.Size = UDim2.new(0, 21, 0, 21)
    dragToggleInner.Position = isDraggable and UDim2.new(1, -23, 0.5, -10.5) or UDim2.new(0, 2, 0.5, -10.5)
    dragToggleInner.BackgroundColor3 = isDraggable and Color3.fromRGB(100, 255, 100) or Color3.fromRGB(255, 255, 255)
    dragToggleInner.BorderSizePixel = 0
    Instance.new("UICorner", dragToggleInner).CornerRadius = UDim.new(0, 10)
    
    dragToggleButton.MouseButton1Click:Connect(function()
        isDraggable = not isDraggable
        dragLabel.Text = "Drag UI: " .. (isDraggable and "ON" or "OFF")
        TweenService:Create(dragToggleInner, TweenInfo.new(0.2, Enum.EasingStyle.Quad), {
            Position = isDraggable and UDim2.new(1, -23, 0.5, -10.5) or UDim2.new(0, 2, 0.5, -10.5),
            BackgroundColor3 = isDraggable and Color3.fromRGB(100, 255, 100) or Color3.fromRGB(255, 255, 255)
        }):Play()
    end)
    
    local function updateKeybindButton()
        if isSettingKey then
            keybindButton.Text = "Press key..."
            local dots = 0
            local dotAnimation
            dotAnimation = RunService.Heartbeat:Connect(function()
                if not isSettingKey then dotAnimation:Disconnect() return end
                dots = (dots + 0.1) % 4
                keybindButton.Text = "Press key" .. string.rep(".", math.floor(dots))
            end)
        else
            keybindButton.Text = "Change Keybind"
            keybindLabel.Text = "Keybind: " .. currentKeybind.Name
        end
    end
    
    keybindButton.MouseButton1Click:Connect(function()
        if isSettingKey then return end
        isSettingKey = true
        updateKeybindButton()
    end)
    
    UserInputService.InputBegan:Connect(function(input)
        if isSettingKey and input.UserInputType == Enum.UserInputType.Keyboard then
            currentKeybind = input.KeyCode
            isSettingKey = false
            updateKeybindButton()
        end
    end)
end

local function renderTools(player, contentFrame, contentLayout)
    if not contentFrame or not contentLayout then return end
    for _, child in ipairs(contentFrame:GetChildren()) do
        if child ~= contentLayout then child:Destroy() end
    end
    
    local tools = getPlayerTools(player)
    if #tools == 0 then
        local noTools = Instance.new("TextLabel", contentFrame)
        noTools.Size = UDim2.new(1, 0, 0, 50)
        noTools.BackgroundTransparency = 1
        noTools.Font = Enum.Font.GothamBold
        noTools.TextSize = 14
        noTools.TextColor3 = Color3.fromRGB(200, 200, 200)
        noTools.Text = "No tools found"
        noTools.TextYAlignment = Enum.TextYAlignment.Center
        return
    end
    
    for i, tool in ipairs(tools) do
        local toolName, toolImage = matchToolName(tool)
        local toolFrame = Instance.new("Frame", contentFrame)
        toolFrame.Size = UDim2.new(1, 0, 0, 70)
        toolFrame.BackgroundColor3 = Color3.fromRGB(30, 25, 45)
        toolFrame.LayoutOrder = i
        Instance.new("UICorner", toolFrame).CornerRadius = UDim.new(0, 10)
        
        local toolIcon = Instance.new("ImageLabel", toolFrame)
        toolIcon.Size = UDim2.new(0, 60, 0, 60)
        toolIcon.Position = UDim2.new(0, 5, 0, 5)
        toolIcon.BackgroundTransparency = 1
        toolIcon.Image = toolImage
        toolIcon.ImageColor3 = Color3.fromRGB(200, 200, 255)
        Instance.new("UICorner", toolIcon).CornerRadius = UDim.new(0, 8)
        
        local toolLabel = Instance.new("TextLabel", toolFrame)
        toolLabel.Size = UDim2.new(1, -75, 1, 0)
        toolLabel.Position = UDim2.new(0, 75, 0, 0)
        toolLabel.BackgroundTransparency = 1
        toolLabel.Font = Enum.Font.GothamBold
        toolLabel.TextSize = 16
        toolLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
        toolLabel.Text = toolName
        toolLabel.TextXAlignment = Enum.TextXAlignment.Left
        
        local rarity = tool:GetAttribute("RarityName") or "Unknown"
        local rarityLabel = Instance.new("TextLabel", toolFrame)
        rarityLabel.Size = UDim2.new(0, 80, 0, 20)
        rarityLabel.Position = UDim2.new(1, -85, 0, 45)
        rarityLabel.BackgroundColor3 = Color3.fromRGB(40, 40, 60)
        rarityLabel.Font = Enum.Font.GothamBold
        rarityLabel.TextSize = 10
        rarityLabel.TextColor3 = getRarityColor(rarity)
        rarityLabel.Text = rarity:upper()
        rarityLabel.TextXAlignment = Enum.TextXAlignment.Center
        Instance.new("UICorner", rarityLabel).CornerRadius = UDim.new(0, 5)
        
        if player and player.Character and tool.Parent == player.Character then
            local equippedLabel = Instance.new("TextLabel", toolFrame)
            equippedLabel.Size = UDim2.new(0, 80, 0, 20)
            equippedLabel.Position = UDim2.new(1, -85, 0, 5)
            equippedLabel.BackgroundColor3 = Color3.fromRGB(40, 120, 60)
            equippedLabel.Font = Enum.Font.GothamBold
            equippedLabel.TextSize = 10
            equippedLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
            equippedLabel.Text = "EQUIPPED"
            equippedLabel.TextXAlignment = Enum.TextXAlignment.Center
            Instance.new("UICorner", equippedLabel).CornerRadius = UDim.new(0, 5)
        end
    end
    
    contentFrame.Size = UDim2.new(1, 0, 0, math.max(300, #tools * 78))
end


local function renderVisuals(player, contentFrame, contentLayout)
    if not contentFrame or not contentLayout then return end
    for _, child in ipairs(contentFrame:GetChildren()) do
        if child ~= contentLayout then child:Destroy() end
    end
    
    local espFrame = Instance.new("Frame", contentFrame)
    espFrame.Size = UDim2.new(1, 0, 0, 60)
    espFrame.BackgroundColor3 = Color3.fromRGB(30, 25, 45)
    espFrame.LayoutOrder = 1
    Instance.new("UICorner", espFrame).CornerRadius = UDim.new(0, 10)
    
    local espLabel = Instance.new("TextLabel", espFrame)
    espLabel.Size = UDim2.new(1, -120, 1, 0)
    espLabel.Position = UDim2.new(0, 15, 0, 0)
    espLabel.BackgroundTransparency = 1
    espLabel.Font = Enum.Font.GothamBold
    espLabel.TextSize = 14
    espLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
    espLabel.Text = "Username ESP"
    espLabel.TextXAlignment = Enum.TextXAlignment.Left
    
    local espToggleButton = Instance.new("TextButton", espFrame)
    espToggleButton.Size = UDim2.new(0, 50, 0, 25)
    espToggleButton.Position = UDim2.new(1, -60, 0.5, -12.5)
    espToggleButton.BackgroundColor3 = Color3.fromRGB(40, 40, 60)
    espToggleButton.Text = ""
    espToggleButton.AutoButtonColor = false
    Instance.new("UICorner", espToggleButton).CornerRadius = UDim.new(0, 12)
    
    local espToggleInner = Instance.new("Frame", espToggleButton)
    espToggleInner.Size = UDim2.new(0, 21, 0, 21)
    espToggleInner.Position = activeESP[player and player.Name] and UDim2.new(1, -23, 0.5, -10.5) or UDim2.new(0, 2, 0.5, -10.5)
    espToggleInner.BackgroundColor3 = activeESP[player and player.Name] and Color3.fromRGB(100, 255, 100) or Color3.fromRGB(255, 255, 255)
    espToggleInner.BorderSizePixel = 0
    Instance.new("UICorner", espToggleInner).CornerRadius = UDim.new(0, 10)
    
    espToggleButton.MouseButton1Click:Connect(function()
        local isActive = activeESP[player and player.Name] ~= nil
        toggleUsernameESP(player, not isActive)
        TweenService:Create(espToggleInner, TweenInfo.new(0.2, Enum.EasingStyle.Quad), {
            Position = not isActive and UDim2.new(1, -23, 0.5, -10.5) or UDim2.new(0, 2, 0.5, -10.5),
            BackgroundColor3 = not isActive and Color3.fromRGB(100, 255, 100) or Color3.fromRGB(255, 255, 255)
        }):Play()
    end)
    
    local distanceFrame = Instance.new("Frame", contentFrame)
    distanceFrame.Size = UDim2.new(1, 0, 0, 60)
    distanceFrame.BackgroundColor3 = Color3.fromRGB(30, 25, 45)
    distanceFrame.LayoutOrder = 2
    Instance.new("UICorner", distanceFrame).CornerRadius = UDim.new(0, 10)
    
    local distanceLabel = Instance.new("TextLabel", distanceFrame)
    distanceLabel.Size = UDim2.new(1, -120, 1, 0)
    distanceLabel.Position = UDim2.new(0, 15, 0, 0)
    distanceLabel.BackgroundTransparency = 1
    distanceLabel.Font = Enum.Font.GothamBold
    distanceLabel.TextSize = 14
    distanceLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
    distanceLabel.Text = "Distance Display"
    distanceLabel.TextXAlignment = Enum.TextXAlignment.Left
    
    local distanceToggleButton = Instance.new("TextButton", distanceFrame)
    distanceToggleButton.Size = UDim2.new(0, 50, 0, 25)
    distanceToggleButton.Position = UDim2.new(1, -60, 0.5, -12.5)
    distanceToggleButton.BackgroundColor3 = Color3.fromRGB(40, 40, 60)
    distanceToggleButton.Text = ""
    distanceToggleButton.AutoButtonColor = false
    Instance.new("UICorner", distanceToggleButton).CornerRadius = UDim.new(0, 12)
    
    local distanceToggleInner = Instance.new("Frame", distanceToggleButton)
    distanceToggleInner.Size = UDim2.new(0, 21, 0, 21)
    distanceToggleInner.Position = activeDistance[player and player.Name] and UDim2.new(1, -23, 0.5, -10.5) or UDim2.new(0, 2, 0.5, -10.5)
    distanceToggleInner.BackgroundColor3 = activeDistance[player and player.Name] and Color3.fromRGB(100, 255, 100) or Color3.fromRGB(255, 255, 255)
    distanceToggleInner.BorderSizePixel = 0
    Instance.new("UICorner", distanceToggleInner).CornerRadius = UDim.new(0, 10)
    
    distanceToggleButton.MouseButton1Click:Connect(function()
        local isActive = activeDistance[player and player.Name] ~= nil
        toggleDistanceDisplay(player, not isActive)
        TweenService:Create(distanceToggleInner, TweenInfo.new(0.2, Enum.EasingStyle.Quad), {
            Position = not isActive and UDim2.new(1, -23, 0.5, -10.5) or UDim2.new(0, 2, 0.5, -10.5),
            BackgroundColor3 = not isActive and Color3.fromRGB(100, 255, 100) or Color3.fromRGB(255, 255, 255)
        }):Play()
    end)
    
    contentFrame.Size = UDim2.new(1, 0, 0, 128)
end

local function showPlayerInventory(player)
    if not player then return end
    if inventoryConnection then 
        inventoryConnection:Disconnect()
        inventoryConnection = nil
    end
    
    selected = player
    title.Text = player.DisplayName .. "'s Inventory"
    scroll.CanvasPosition = Vector2.new(0, 0)
    clearScrollContent()
    
    local tabContainer = Instance.new("Frame", scroll)
    tabContainer.Size = UDim2.new(1, 0, 0, 40)
    tabContainer.BackgroundTransparency = 1
    tabContainer.LayoutOrder = 1
    
    local toolsTab = Instance.new("TextButton", tabContainer)
    toolsTab.Size = UDim2.new(0.5, -4, 1, 0)
    toolsTab.Position = UDim2.new(0, 0, 0, 0)
    toolsTab.Text = "Tools"
    toolsTab.Font = Enum.Font.GothamBold
    toolsTab.TextSize = 15
    toolsTab.TextColor3 = Color3.fromRGB(255, 255, 255)
    toolsTab.BackgroundColor3 = Color3.fromRGB(80, 60, 200)
    Instance.new("UICorner", toolsTab).CornerRadius = UDim.new(0, 8)
    
    local visualsTab = Instance.new("TextButton", tabContainer)
    visualsTab.Size = UDim2.new(0.5, -4, 1, 0)
    visualsTab.Position = UDim2.new(0.5, 4, 0, 0)
    visualsTab.Text = "Visuals"
    visualsTab.Font = Enum.Font.GothamBold
    visualsTab.TextSize = 15
    visualsTab.TextColor3 = Color3.fromRGB(200, 200, 200)
    visualsTab.BackgroundColor3 = Color3.fromRGB(40, 30, 60)
    Instance.new("UICorner", visualsTab).CornerRadius = UDim.new(0, 8)
    
    local indicator = Instance.new("Frame", tabContainer)
    indicator.Size = UDim2.new(0.5, -4, 0, 4)
    indicator.Position = UDim2.new(0, 0, 1, -4)
    indicator.BackgroundColor3 = Color3.fromRGB(120, 100, 255)
    Instance.new("UICorner", indicator).CornerRadius = UDim.new(0, 2)
    
    local contentFrame = Instance.new("Frame", scroll)
    contentFrame.Size = UDim2.new(1, 0, 0, 300)
    contentFrame.Position = UDim2.new(0, 0, 0, 0)
    contentFrame.BackgroundTransparency = 1
    contentFrame.LayoutOrder = 2
    
    local contentLayout = Instance.new("UIListLayout", contentFrame)
    contentLayout.SortOrder = Enum.SortOrder.LayoutOrder
    contentLayout.Padding = UDim.new(0, 8)
    
    local function animateTab(tab, otherTab, indicatorPos)
        if not tab or not otherTab or not indicator then return end
        TweenService:Create(tab, TweenInfo.new(0.2, Enum.EasingStyle.Quad), {
            BackgroundColor3 = Color3.fromRGB(80, 60, 200),
            TextColor3 = Color3.fromRGB(255, 255, 255)
        }):Play()
        TweenService:Create(otherTab, TweenInfo.new(0.2, Enum.EasingStyle.Quad), {
            BackgroundColor3 = Color3.fromRGB(40, 30, 60),
            TextColor3 = Color3.fromRGB(200, 200, 200)
        }):Play()
        TweenService:Create(indicator, TweenInfo.new(0.2, Enum.EasingStyle.Quad), {
            Position = indicatorPos
        }):Play()
    end
    
    local function showToolsTab()
        currentTab = "Tools"
        animateTab(toolsTab, visualsTab, UDim2.new(0, 0, 1, -4))
        if inventoryConnection then
            inventoryConnection:Disconnect()
            inventoryConnection = nil
        end
        renderTools(player, contentFrame, contentLayout)
        inventoryConnection = RunService.Heartbeat:Connect(function()
            if currentTab == "Tools" then
                renderTools(player, contentFrame, contentLayout)
            end
        end)
    end
    
    toolsTab.MouseButton1Click:Connect(showToolsTab)
    
    visualsTab.MouseButton1Click:Connect(function()
        currentTab = "Visuals"
        animateTab(visualsTab, toolsTab, UDim2.new(0.5, 4, 1, -4))
        if inventoryConnection then
            inventoryConnection:Disconnect()
            inventoryConnection = nil
        end
        renderVisuals(player, contentFrame, contentLayout)
    end)
    
    showToolsTab()
    
    if backButton then backButton:Destroy() end
    backButton = Instance.new("TextButton", frame)
    backButton.Name = generateName()
    backButton.Size = UDim2.new(0, 100, 0, 30)
    backButton.Position = UDim2.new(0, 10, 1, -40)
    backButton.Text = "<-- Back"
    backButton.Font = Enum.Font.GothamBold
    backButton.TextSize = 14
    backButton.TextColor3 = Color3.fromRGB(255, 255, 255)
    backButton.BackgroundColor3 = Color3.fromRGB(80, 60, 200)
    Instance.new("UICorner", backButton).CornerRadius = UDim.new(0, 8)
    
    backButton.MouseButton1Click:Connect(function()
        if inventoryConnection then 
            inventoryConnection:Disconnect()
            inventoryConnection = nil
        end
        
         
        clearScrollContent()
        renderPlayerList()
        title.Text = "Select Player"
        if backButton then
            backButton:Destroy()
            backButton = nil
        end
    end)
end

function renderPlayerList()
    clearScrollContent()
    local playerCount = 0
    for _, player in ipairs(Players:GetPlayers()) do
        if player ~= Players.LocalPlayer then
            playerCount = playerCount + 1
            local playerButton = Instance.new("TextButton", scroll)
            playerButton.Size = UDim2.new(1, 0, 0, 50)
            playerButton.BackgroundColor3 = Color3.fromRGB(40, 30, 60)
            playerButton.Font = Enum.Font.GothamBold
            playerButton.TextSize = 15
            playerButton.TextColor3 = Color3.fromRGB(255, 255, 255)
            playerButton.Text = player.DisplayName
            playerButton.LayoutOrder = playerCount
            Instance.new("UICorner", playerButton).CornerRadius = UDim.new(0, 10)
            
            local hoverTween = TweenService:Create(playerButton, TweenInfo.new(0.2, Enum.EasingStyle.Quad), {
                BackgroundColor3 = Color3.fromRGB(60, 45, 90)
            })
            local normalTween = TweenService:Create(playerButton, TweenInfo.new(0.2, Enum.EasingStyle.Quad), {
                BackgroundColor3 = Color3.fromRGB(40, 30, 60)
            })
            
            playerButton.MouseEnter:Connect(function() hoverTween:Play() end)
            playerButton.MouseLeave:Connect(function() normalTween:Play() end)
            playerButton.MouseButton1Click:Connect(function() showPlayerInventory(player) end)
        end
    end
end

local function makeDraggable(uiElement)
    local dragging = false
    local dragInput, dragStart, startPos
    
    local function update(input)
        local delta = input.Position - dragStart
        uiElement.Position = UDim2.new(startPos.X.Scale, startPos.X.Offset + delta.X, startPos.Y.Scale, startPos.Y.Offset + delta.Y)
    end
    
    uiElement.InputBegan:Connect(function(input)
        if input.UserInputType == Enum.UserInputType.MouseButton1 or input.UserInputType == Enum.UserInputType.Touch then
            dragging = true
            dragStart = input.Position
            startPos = uiElement.Position
            input.Changed:Connect(function()
                if input.UserInputState == Enum.UserInputState.End then
                    dragging = false
                end
            end)
        end
    end)
    
    uiElement.InputChanged:Connect(function(input)
        if input.UserInputType == Enum.UserInputType.MouseMovement or input.UserInputType == Enum.UserInputType.Touch then
            dragInput = input
        end
    end)
    
    UserInputService.InputChanged:Connect(function(input)
        if input == dragInput and dragging and isDraggable then
            update(input)
        end
    end)
end

createKeybindSettings()

settingsButton.MouseButton1Click:Connect(function()
    settingsFrame.Visible = not settingsFrame.Visible
    scroll.Visible = not settingsFrame.Visible
end)

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

Players.PlayerRemoving:Connect(function(player)
    if player == selected then
        title.Text = "Player Left!"
    end
    if activeESP[player.Name] then
        activeESP[player.Name]:Destroy()
        activeESP[player.Name] = nil
    end
    if activeDistance[player.Name] then
        activeDistance[player.Name]:Destroy()
        activeDistance[player.Name] = nil
    end
end)

Players.PlayerAdded:Connect(renderPlayerList)
renderPlayerList()

UserInputService.InputBegan:Connect(function(input)
    if input.KeyCode == currentKeybind and not isSettingKey then
        gui.Enabled = not gui.Enabled
    end
end)

makeDraggable(frame)

Features & Information

View inventory opensource Visuals dosent even Work (fire?) Made by skids and AI (ui)

Community Comments (0)

No comments yet for this script.

More Scripts for BlockSpin 🔪 [MANSION UNDERGROUND]