Random avatar picker?

Well, uhh. I’m trying to make a random avatar picker, but I don’t know how to do it. For example, Load Character. How can I do this using a script? I think it’s related to HumanoidDescription, but it is supposed to be random.

Thanks, Vaelkarr.

1 Like

I would recommend doing something like querying for catalog items and then picking random items from the catalog to wear. That way, you get items that are actually valid without having to check if a randomly generated assetId is valid 2000 times. IIRC you still cannot directly query the catalog API, but you can use proxies to do so, or just query the data yourself and store it as a table in the script.

local hats = catalogProxy:Query(Category.Acessories, 30) --you need to set up this query
local myHat = hats[math.random(#hats)] --pick a random accessory asset
print(myHat, myHat.id) --catalog API returns a bunch of objects
--their id property can be used for the InsertService/AssetService

Here are some guides:

Example query: (returns JSON)
https://catalog.roblox.com/v1/search/items/details?Subcategory=19&SortType=0&SortAggregation=5&Limit=30

2 Likes

I don’t really know how to get catalog proxy and I am searching External Catalog Queries | Documentation - Roblox Creator Hub. How could I get it then?

You can find proxies online, a dated example being https://rprxy.xyz/ (which im not sure works any longer?)
You can also make your own with minimal PHP knowledge and github pages or anything really. This is because Roblox (from what I remember) does not allow direct access to their APIs from within Roblox games. The proxy serves as a ‘middle man’ or mediator between your request and the catalog API.
Example query using the proxy instead:
https://catalog.rprxy.xyz/v1/search/items/details?Subcategory=19&SortType=0&SortAggregation=5&Limit=30

There is also an out of date (potentially) catalog API that is more flexible than this API, allowing for more items to be grabbed.
https://search.roblox.com/catalog/json?Subcategory=19&SortType=0&SortAggregation=5&ResultsPerPage=100&PageNumber=1

Although I think PageNumber exists on the new endpoint too.