I already tried looking for information on developer roblox but I didn't find anything useful. What I'm trying to do is to sort a value based on the value inside of it.
For example:
I have a number value called: Apple. This value is used to find the quantity of the item. Then inside of the value there's another number value that determines the rarity of the item.
I'm trying to use this script:
for i,v in pairs(game.ReplicatedStorage.PlayerData:WaitForChild(game.Players.LocalPlayer.Name):GetChildren()) do
if v.Type.Value == "Item" then
if v.Value >= 1 then
local item = script.ItemTemplate:Clone()
item.Parent = script.Parent.Inventory.ItemInv
item.Visible = true
item.Position = UDim2.new(0,x,0,y)
item.Name = v.Name
if v.Value > 1 then
item.ItemName.Text = v.Name.." ("..v.Value.."x)"
else
item.ItemName.Text = v.Name
end
item.Rarity.Text = v.Rarity.Value
end
end
end
Where exactly can I use table.sort, and how?
