PcoWSkbVqDnWTu_dm2ix

Avatar Editor Service

Avatar Editor Service

10 min

articles/roblox avatars|Avatars are a big part of players expressing themselves on Roblox. Using AvatarEditorService along with an in-game avatar editor, you can let players customize their character and take it everywhere they go.

Reading Player Inventory

AvatarEditorService has various functions and events for working with items already in a player’s inventory.

Allowing Access

To begin using inventory-related methods, you’ll need to prompt the player to allow access via AvatarEditorService/PromptAllowInventoryReadAccess|PromptAllowInventoryReadAccess().

The player’s response can then be tracked by waiting for the AvatarEditorService/PromptAllowInventoryReadAccessCompleted|PromptAllowInventoryReadAccessCompleted event:

Getting Inventory

Once access is granted by the player, you can read their inventory with the AvatarEditorService/GetInventory|GetInventory() function, supplying an array of enum/AvatarAssetType|AvatarAssetTypes to gather. This function returns an InventoryPages object containing the player’s owned items.

Searching the Catalog

AvatarEditorService includes functions and events which let you search the Roblox catalog. To begin, construct a datatype/CatalogSearchParams object and supply the desired properties:

Property Type Default
AssetTypes array of Enum/AvatarAssetType
BundleTypes array of Enum/BundleType
CategoryFilter Enum/CatalogCategoryFilter Enum.CatalogCategoryFilter.None
MaxPrice integer
MinPrice integer  0
SearchKeyword string
SortType Enum/CatalogSortType Enum.CatalogSortType.Relevance

With a valid datatype/CatalogSearchParams, call AvatarEditorService/SearchCatalog|SearchCatalog(). This function returns a CatalogPages object containing the results.

Saving Avatars and Outfits

When used alongside an in-game avatar editor, AvatarEditorService is ideal for saving avatars/outfits to the Roblox platform.

Saving as Avatar

Any HumanoidDescription can be saved to the player’s current avatar with AvatarEditorService/PromptSaveAvatar|PromptSaveAvatar(). This may include:

  • Pre-defined avatar configurations that you’ve built using existing catalog items.
  • Any configuration that the player has chosen through an in-game avatar editor.

AvatarEditorService/PromptSaveAvatar|PromptSaveAvatar() does not yield and you can get the result by listening to the AvatarEditorService/PromptSaveAvatarCompleted|PromptSaveAvatarCompleted event:

Saving as Outfit

To save any HumanoidDescription as an outfit (without overwriting the player’s current avatar), use AvatarEditorService/PromptCreateOutfit|PromptCreateOutfit().

Once called, you can get the result of AvatarEditorService/PromptCreateOutfit|PromptCreateOutfit() by listening to the AvatarEditorService/PromptCreateOutfitCompleted|PromptCreateOutfitCompleted event:

Handling Item Purchases

When saving either an avatar or an outfit that uses catalog items, the player will not receive any items that they do not own. Thus, before calling either AvatarEditorService/PromptSaveAvatar|PromptSaveAvatar() or AvatarEditorService/PromptCreateOutfit|PromptCreateOutfit(), the recommended workflow is:

  1. Determine if the player does not own any items they’re trying to save via MarketplaceService/PlayerOwnsAsset|MarketplaceService:PlayerOwnsAsset().
  2. For non-owned items, give the player an option to purchase them using MarketplaceService/PromptPurchase|MarketplaceService:PromptPurchase().
Tags:
  • avatar
  • inventory
  • outfit
  • costume