I know how to get the price of a product/pass, I just don’t know how to use table.sort
properly.
I tried using a secondary value in the table (like a custom order argument), but still didn’t work.
-- List example:
--[[
Donations = {
Robux5 = {
Name = "5 Robux",
Description = "",
ID = 1573607207,
Color = ColorSequence.new({
ColorSequenceKeypoint.new(0, Color3.new(0.223529, 0.764706, 0.717647)),
ColorSequenceKeypoint.new(1, Color3.new(0.239216, 0.721569, 0.6))
})
},
Robux10 = {
Name = "10 Robux",
Description = "",
ID = 1573607253,
Color = ColorSequence.new({
ColorSequenceKeypoint.new(0, Color3.new(0.223529, 0.764706, 0.717647)),
ColorSequenceKeypoint.new(1, Color3.new(0.239216, 0.721569, 0.6))
})
},
--]]
for ListName, List in pairs(AveloData.Store) do
local NewList = Store.Lists.Template:Clone()
NewList.Name = ListName
NewList.Parent = Store.Lists
NewList.Visible = true
-- Here is where I need to sort the list, in order of the price of the product or pass, using the same logic/code below with MarketplaceService.
table.sort(List,function()
-- no idea what to put here
end)
for _, Item in pairs(List) do
local ProductInfo = nil
local IsPass, response = pcall(function()
ProductInfo = MarketplaceService:GetProductInfo(tonumber(Item.ID), Enum.InfoType.GamePass)
end)
-- If the response above was a failure, it was likely because it's a devproduct, now trying a devproduct check below
if not IsPass then
local succ, response = pcall(function()
ProductInfo = MarketplaceService:GetProductInfo(Item.ID, Enum.InfoType.Product)
end)
end
-- If it can't find the product, or something else, give up on this item
if ProductInfo == nil then return end
-- Start Creation of the frame
local NewItem = NewList.Template:Clone()
If anyone can help, it’d be really appreciated