Okay so I created a script that gets my Developer Products and copies the data into a frame so I can keep adding Dev products and the shop will update without me really doing anything. So the code to create these presets is this:
local scroller = script.Parent.scroller
local devProducts = game:GetService("MarketplaceService")
local products = devProducts:GetDeveloperProductsAsync():GetCurrentPage()
local market = game:GetService('MarketplaceService')
for _,v in pairs(products) do
local cl = script.B1:Clone()
cl.Parent = script.Parent.scroller
cl.icon.Image = "rbxassetid://"..v.IconImageAssetId
cl.Title.Text = v.Name
cl.Name = v.Name
cl.buy.MouseButton1Down:Connect(function()
market:PromptProductPurchase(game.Players.LocalPlayer, v.ProductId)
end)
end
The only problem is it's not in order of the 'gem amount' so it goes like 1000, 250, 750, 10000 any help with this?
The table layout is like this - local products = { ["random name roblox makes"] = { ["Name"] = "product1", ["PriceInRobux" = 100 } }
(that's not exactly it but I assume you understand.)
Basically I just want the frames to be ordered in Robux Price (which can be easily gained with v.PriceInRobux, it returns a string)
SOLVED (EDIT) This was solved by putting each dictionary into one table, and then using a custom table.sort function that checks the dictionary value PriceInRobux and then sorts them using that value. If anyone else has this problem here is the sorting function
Change PriceInRobux to the value you want to sort your dictionaries by
table.sort(sortedTables, function(a, b) return tonumber(a.PriceInRobux) < tonumber(b.PriceInRobux) end)

6 comments
You could use a UIListLayout and name them based on their gem amount as an easy solution
You can put the dev products in a dictionary and use table.sort
^^ Probably better. I was going to say if you added them into a table then table.sort would sort them least to greatest numerically or you could add your own function to sort greatest to least etc
The problem with putting them in a table is, how would I then transfer that into the frames on the gui?
Yeah I see how I would do it, I would put them into a sorted dictionary and then transfer that into the frames. Thanks I'll try it out tomorrow i'm not on my PC
The dev products are dictionaries. They each contain their own special data so could you even put a dictionary into a dictionary, even if it was possible how would I then create the frames to hold that data.