hello ive been trying to make a avatar editor, i did a test script to familirise myself whit avatarEditorService and catalogsearchparms but one weird thing stood out
ive tried searching on the doccumentation and so far i dint find anything about it
current script:
Hi there, maybe you could try this script, it works fine for me…
local avatarEditorService = game:GetService("AvatarEditorService")
local params = CatalogSearchParams.new()
params.SearchKeyword = "[V1] Black Pierced Wide Brim Hat"
params.AssetTypes = {Enum.AvatarAssetType.Hat}
params.IncludeOffSale = true
params.Limit = 10
local success, searchedstuff = pcall(function()
return avatarEditorService:SearchCatalog(params)
end)
if success and searchedstuff then
local firstPage = searchedstuff:GetCurrentPage()
if firstPage then
for _, item in pairs(firstPage) do
print(item.Name, item.Id)
end
else
warn("Nothing found :/")
end
else
warn("Search failed")
end
Edit: Please don’t make the limit higher because the search will fail because its too much
Like the others said, this is expected behaviour. Pages objects are Roblox’s way of doing paginated data - it avoids creating one absolutely massive table with loads of entries in it. And, well, since the AvatarEditorService can’t consistently predict how many returns it will get (cause issues between returning tables and pages), it just returns a pages object no matter what. The same goes for things like DataStore:ListKeysAsync().
You can iterate over all assets like so:
while (not searchedstuff.IsFinished) do
local page = searchedstuff:GetCurrentPage()
for k, v in next, page, nil do
--etc.
end
searchedstuff:AdvanceToNextPageAsync()
end