The RobloxCatalogService only returns 1 item and can only take one category.
Search is a textbox. Im trying to make a new avatar customise system. I need alot more than 1 item. When It did work it only rpoducded 30 items aswell. But I need way more.
Code:
local AvatarEditorService = game:GetService("AvatarEditorService")
local template = script.Parent.Template
local assetTypes = {
Enum.AvatarAssetType.Shirt,
--Enum.AvatarAssetType.Pants
}
local function loadItems(assetTypes, searchText)
local catalogSearchParams = CatalogSearchParams.new()
catalogSearchParams.AssetTypes = assetTypes
catalogSearchParams.IncludeOffSale = true
if searchText ~= nil then
catalogSearchParams.SearchKeyword = searchText
end
local assets = {}
local pagesObject = AvatarEditorService:SearchCatalog(catalogSearchParams)
local currentPage = pagesObject:GetCurrentPage()
for i = 1, #currentPage do
local asset = currentPage[i]
local id = asset.Id
local name = asset.Name
local img = "rbxthumb://type=Asset&id=".. id .."&w=420&h=420"
assets[#assets + 1] = {Id = id, Name = name, Image = img}
end
for i,v in pairs(assets) do
local t = template:Clone()
t.Name = v.Name
t.ID.Value = v.Id
t.pfp.Image = v.Image
t.Visible = true
t.Parent = script.Parent.Parent.Scroller
end
end
loadItems(assetTypes, nil)
local search = script.Parent.Parent.Parent.Search.SearchBox
search.InputEnded:Connect(function()
loadItems(assetTypes, search.Text)
end)
Update: This has gotten worse. Now no things appear and the code is exactly the same. The image has been replaced with the default place image even tho it should show you the ID’s image. And theres loads of errors that have no text in them in the output.
You’re probably better off using the external catalog REST API, especially for high-request projects like avatar customization. I think Roblox is allowing requests to roblox.com soon, but I’m not entirely sure if it was rolled out yet. If it hasn’t been, you’ll have to use a proxy like RoProxy.com or build your own because Roblox doesn’t allow queries to roblox.com APIs inside of games. Rprxy.xyz shut down awhile ago because Heroku ended their free tier.
All asset types have a hard maximum of 120 items per page.
You can specify the number displayed with the Limit parameter. The accepted values are 10, 28, 30, 60, and 120 (you can see this here).
So, if you wanted to make a search for the first 120 shirts matching the “hello” keyword, you would use this URL: https://catalog.roblox.com/v2/search/items/details?subcategory=59&Limit=120&keyword=hello.
If you need to search for more than 120 at a time, then you’ll have to make more than one search or create a proxy that caches multiple requests into one.