Universal Script 📌
413 Views
18 Executions

Print Your entire Inventory

Universal Script 📌
becausewhyy
becausewhyyPublished 10
6 months ago
Get an executor
Please login to perform these actions:

Does it work?

No reports yet

No reports yet. Tried it? Be the first to say.

Also noticed:

Description

prints ur entire backpack/inventory and says how many of that thing u have

View Raw
local player = game.Players.LocalPlayer

local function getAllItems()
    local items = {}

    local function scan(container)
        if not container then return end
        for _, v in pairs(container:GetChildren()) do
            if v:IsA("Tool") then
                items[v.Name] = (items[v.Name] or 0) + 1
            end
        end
    end

    scan(player:FindFirstChild("Backpack"))
    scan(player.Character)

    return items
end

local function printSortedInventory()
    local items = getAllItems()

    local list = {}
    for name, count in pairs(items) do
        table.insert(list, {name = name, count = count})
    end

    table.sort(list, function(a, b)
        return a.count < b.count
    end)

    for _, item in ipairs(list) do
        print(item.name .. " x" .. item.count)
    end
end

printSortedInventory()


Comments

0
Log in to join the conversation. Login
No comments yet. Be the first!