How would I achieve this?

Hello, I recently got an idea but don’t know how to do it…

I want to be able to get use a math.random function to choose a random accessory
within the player’s inventory (their own, from the ROBLOX Avatar/Inventory Page).

How would I get the items from a specific category (example: hats) to
be shown / fetched?

Avatar Editor Service is exactly what you are looking for! here’s a page on how to use it!

https://create.roblox.com/docs/reference/engine/classes/AvatarEditorService#GetInventory

for Filtering Asset Types , like hat as you mentioned

1 Like

Lovely! Would there also be a simple way of putting it into a table?

1 Like
local assetTypes = {
Enum.AvatarAssetType.BackAccessory,
Enum.AvatarAssetType.ShoulderAccessory,
Enum.AvatarAssetType.WaistAccessory

--documentation's example 
}

it says array in the documentation, that may include dictionaries

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.