Here’s how I currently cache thousands of Ids. I generated these a few months back, however, these get outdated quickly, and I can’t do further things, like add a search for items/etc. in my avatar editor.
So Im wanting a way where I can auto generate say once a week automatically in game, that generates the most favorited/best selling items in the catalog for that week, and would mean every single player in every server views the exact same set of items.
This was the code I used to generate the list and manually copy/paste the outputted Ids to the code.
local CYCLES = 25
local AvatarEditorService = game:GetService("AvatarEditorService")
local function GenerateItems(assetType)
local Params = CatalogSearchParams.new()
Params.AssetTypes = { assetType }
Params.SortType = Enum.CatalogSortType.MostFavorited
Params.IncludeOffSale = true
local CatalogPages = AvatarEditorService:SearchCatalog(Params)
local ItemIds = {}
local Pages = 0
while Pages < CYCLES do
local CurrentPage = CatalogPages:GetCurrentPage()
for _, itemInfo in CurrentPage do
table.insert(ItemIds, itemInfo.Id)
end
if CatalogPages.IsFinished then
break
end
CatalogPages:AdvanceToNextPageAsync()
Pages += 1
task.wait()
end
print(ItemIds)
end
As stated above, I want a way that’d automate this fully, maybe using data stores/memory store to keep everything easy. Unsure how I’d organize across clients and again, how I can do a search system for players to enter a keyword, say “blue” and it’d bring up any blue based items, cause atm, all I have is the ids, and Id have to get info for hundreds of items, in seconds. I want the search to be instant