Simple question:
How can I insert all the faces in the catalog into the game via a script?
Simple question:
How can I insert all the faces in the catalog into the game via a script?
There are different methods to do this, an experimental one comes to mind, where you use a combination of marketplaceservice and insertservice. You could use a for loop to up the number each time in the assetid, and use getproductinfo, check with assetTypeId and if it is a face, then use insertservice to load the asset in.
Alternatively, you could use HTTP services and fetch the url of the catalog. Good luck
Wouldnât iterating over all those ids take forever ?
It definitely would take its time, I would just manually grab the assetid from the catalog through copy/paste but, this method exists in case you donât want to do that.
I would recommend using Robloxâs Catalog API (not from within the gameâyou canât do that) to retrieve all faces and their catalog information, then insert it into the game and convert the JSON using HttpService:JSONDecode(json). This would require you to manually update faces when new faces are added, but itâs a lot faster than doing it by inserting a boatload of face decals until you get what you want.
Hereâs some links to get you started:
EDIT: Shouldâve probably left you an example link. If you use Firefox, the JSON will automatically be âbeautifiedâ (easier to read).
https://search.roblox.com/catalog/json?CatalogContext=1&Category=4
The HTTP one definitely works, it requires a bit of knowledge of how websites work but look into it. I was thinking something similar to this, I havenât ever tried it though. Nice links. I for sure learned something new.
Thereâs no need to understand how websites work to understand JSON, and on top of that you donât even have to understand JSON to use this information from within Roblox.
You can turn the JSON string into an array using HttpService:JSONDecode(jsonstring), which would then return the array for you to easily access as a normal table. For instance, to get the name of the first returned face asset using the sample link I sent above, youâd just do decodedJSON[1].Name
, where decodedJSON is the result HttpService:JSONDecode(jsonstring) returns. The name would be âErrâŚâ in this case.