Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would I make it that the inventory would organize itself?

Asked by 8 years ago
wait()
local plr = game.Players.LocalPlayer
local inv = plr.minventory -- gets the inventory items in the inventory, note i'm using DataStore to save the inventory.

for i, v in pairs(inv:GetChildren()) do
    if v:IsA('IntValue') then
        if v.Value > 0 then
            frame = script.Item:Clone()
            frame.Parent = script.Parent.materialtab
            frame.Name = 'Item'..i
            frame.amount.Text = v.Value
            frame.name.Text = v.Name
            frame.Position = UDim2.new(i/10 + i/100 + 0.01, 0, 0.05, 0)-- this is the position of the item, now how would I make it so it's in order, Copper is the 6th item in the table, and always goes on the 6th slot, even if it's the only item in the inventory.
            frame.Visible = true
        end
    end
end
-- How would I make it so if copper was the only item in the inventory, it goes to slot 1 instead of slot 6
0
Your inventory model doesn't work like that, it appears. User#6546 35 — 8y
0
It's either impossible or i'm bad at scripting. supermarioworld323 45 — 8y

Answer this question