For whatever reason I'm trying to get a list of all available hats in a script (then put them in a table but that's not important). I know this has been done in games that use limited hats only, and games such as catalog heaven but I looked through an uncopylocked version of catalog heaven and couldn't figure out how it works to get all the gears (skimmed it due to 3000+ lines of code). I've also looked around on google for a little bit but I'm not sure I'm wording my searches correctly. I'm not asking for a script, just maybe a link?
I recommend using the ":getChildren()" function. What it does is that it scans through whatever object (such as a script or a brick) and gives you back all the children associated with it.
Here's a code sample:
YourTableName = LocationOfYourObject:getChildren() print(YourTablename)
Here's a DevWiki tutorial: https://www.robloxdev.com/api-reference/function/Instance/GetChildren
If you have any questions or issues, please contact me. ;)