AvatarEditorService

Show Deprecated
Not Creatable
Service
Not Replicated

AvatarEditorService is a service to support developer Avatar Editors. It provides methods to modify the player's platform avatar, request information about a user's inventory, and request information about the catalog.

For more information regarding the Avatar Editor, see Avatar Editor Service.

Summary

Properties

Methods


Prompts the Players.LocalPlayer to allow the developer to read what items the user has in their inventory and other avatar editor related information.


Prompts the Players.LocalPlayer to save the given HumanoidDescription as an outfit.

PromptDeleteOutfit(outfitId: number)  

Prompts the Players.LocalPlayer to delete the given outfit.

PromptRenameOutfit(outfitId: number)  

Prompts the Players.LocalPlayer to rename the given outfit.

PromptSaveAvatar(humanoidDescription: HumanoidDescription, rigType: HumanoidRigType)  

Prompts the Players.LocalPlayer to update their avatar based on the given HumanoidDescription and RigType of R6 or R15.

PromptSetFavorite(itemId: number, itemType: AvatarItemType, shouldFavorite: boolean)  

Prompts the Players.LocalPlayer to favorite or unfavorite the given asset or bundle.

PromptUpdateOutfit(outfitId: number, updatedOutfit: HumanoidDescription, rigType: HumanoidRigType)  

Prompts the Players.LocalPlayer to update the given outfit.


Used to apply default clothing to the HumanoidDescription if necessary.

GetAvatarRules(): table  YIELDS

Returns the platform Avatar rules for things such as scaling, default shirts and pants, number of wearable assets.

GetBatchItemDetails(itemIds: Array, itemType: AvatarItemType): Array  YIELDS

Gets the item details for a list of items at once.

GetFavorite(itemId: number, itemType: AvatarItemType): boolean  YIELDS

Returns if the Players.LocalPlayer has favorited the given bundle or asset.

GetInventory(assetTypes: Array): InventoryPages  YIELDS

Returns an InventoryPages object with information about owned items in the users inventory with the given AvatarAssetTypes.

GetItemDetails(itemId: number, itemType: AvatarItemType): table  YIELDS

Returns the item details for the given item.

GetOutfitDetails(outfitId: number): table  YIELDS

Returns the outfit details for the given outfit.

GetOutfits(outfitSource: OutfitSource, outfitType: OutfitType): OutfitPages  YIELDS

Returns outfit data for the Players.LocalPlayer.

GetRecommendedAssets(assetType: AvatarAssetType, contextAssetId: number): Array  YIELDS

Returns a list of recommended assets based on a given AssetType and asset id.

GetRecommendedBundles(bundleId: number): Array  YIELDS

Returns a list of recommended bundles for a given bundle id.

SearchCatalog(searchParameters: CatalogSearchParams): CatalogPages  YIELDS

Returns a CatalogPages object containing the result of the given search.

Events


Fires when the PromptSaveOutfit operation is completed.


Fires when the PromptDeleteOutfit operation is completed.


Fires when the PromptRenameOutfit operation is completed.


Fires when the AvatarEditorService:PromptSaveAvatar() operation is completed.

Properties

Methods

GetAccessoryType

Parameters

avatarAssetType: AvatarAssetType

Returns

PromptAllowInventoryReadAccess

Prompts the Players.LocalPlayer to allow the developer to read what items the user has in their inventory and other avatar editor related information. The prompt needs to be confirmed by the user for the developer to use AvatarEditorService:GetInventory(), AvatarEditorService:GetOutfits() and AvatarEditorService:GetFavorite(). Permission does not persist between sessions.


Returns

PromptCreateOutfit

Prompts the Players.LocalPlayer to save the given HumanoidDescription as an outfit. Does not yield. The result can be retrieved by listening to the AvatarEditorService.PromptCreateOutfitCompleted event.

Parameters

The Outfit that the player will be prompted to created.

The RigType that the outfit will be created for if the player confirms the prompt.


Returns

PromptDeleteOutfit

Prompts the Players.LocalPlayer to delete the given outfit. Does not yield. The result can be retrieved by listening to the AvatarEditorService.PromptDeleteOutfitCompleted event.

Parameters

outfitId: number

The outfitId of the outfit to delete.


Returns

PromptRenameOutfit

Prompts the Players.LocalPlayer to delete the given outfit. Does not yield. The result can be retrieved by listening to the AvatarEditorService.PromptRenameOutfitCompleted event.

Parameters

outfitId: number

The outfitId of the outfit to rename.


Returns

PromptSaveAvatar

This function prompts the Players.LocalPlayer to update their avatar based on the given HumanoidDescription and RigType (R6 or R15). Does not yield and can get the result by listening to the PromptSaveAvatarCompleted event. This is similar to how other prompts such as PromptPurchase work.

Parameters

humanoidDescription: HumanoidDescription

The given HumanoidDescription being prompted to save.

The RigType that the avatar will be saved for if the player confirms the prompt.


Returns

PromptSetFavorite

This function prompts the Players.LocalPlayer to favorite or unfavorite the given asset or bundle.

Parameters

itemId: number

The ItemId of the item being prompted to favorite.

itemType: AvatarItemType

The type of item being prompted to favorite.

shouldFavorite: boolean

Returns

PromptUpdateOutfit

Prompts the Players.LocalPlayer to update the given outfit with the given HumanoidDescription.

Parameters

outfitId: number

The outfitId of the outfit to update.

updatedOutfit: HumanoidDescription

A HumanoidDescription that represents the new outfit data.

The HumanoidRigType to update the outfit to.


Returns

CheckApplyDefaultClothing

Yields

Returns a new HumanoidDescription with the Shirt and Pants properties updated if necessary. Returns nil if default clothing was not needed.

Default clothing is necessary if the HumanoidDescription does not currently have Shirt and Pants equipped and the body colors are too similar.

Parameters

humanoidDescription: HumanoidDescription

The HumanoidDescription to check if default clothing is required.


Returns

Returns a HumanoidDescription if default clothing was necessary. Otherwise returns nil.

ConformToAvatarRules

Yields

Parameters

humanoidDescription: HumanoidDescription

Returns

GetAvatarRules

Yields

This function returns the platform Avatar rules for things like scaling, default shirts and pants, number of wearable assets, ect.

The returned table includes the following fields:


{
"PlayerAvatarTypes": [
"R6"
],
"Scales": {},
"WearableAssetTypes": [
{
"MaxNumber": 0,
"Id": 0,
"Name": "string"
}
],
"BodyColorsPalette": [
{
"BrickColorId": 0,
"NexColor": "string",
"Name": "string"
}
],
"BasicBodyColorsPalette": [
{
"BrickColorId": 0,
"HexColor": "string",
"Name": "string"
}
],
"MinimumDeltaEBodyColorDifference": 0,
"ProportionsAndBodyTypeEnabledForUser": true,
"DefaultClothingAssetLists": {
"DefaultShirtAssetIds": [
0
],
"DefaultPantAssetIds": [
0
]
},
"BundlesEnabledForUser": true,
"EmotesEnabledForUser": true
}

Returns

A dictionary containing the platform Avatar rules for things like scaling, default shirts and pants, number of wearable assets, ect. See the example return in the main description above.

GetBatchItemDetails

Yields

Gets the item details for a list of items at once. More efficient than AvatarEditorService:GetItemDetails if you need to get all the item details of a list.

Parameters

itemIds: Array

The list of item ids to get details of.

itemType: AvatarItemType

The type of the item ids provided.


Returns

Returns an array of item details with the following fields:


{
"AssetType" = "string",
"CreatorName" = "string",
"CreatorTargetId" = 0,
"CreatorType" = "string",
"Description" = "string",
"FavoriteCount" = 0,
"Genres" = [
"All"
],
"Id" = 0,
"ItemRestrictions" = [
"Limited"
],
"ItemStatus": [
"New"
],
"ItemType" = "string",
"LowestPrice" = 0,
"Name" = "string",
"Price" = 0,
"ProductId" = 0
}
```.

GetFavorite

Yields

This function returns if the Players.LocalPlayer has favorited the given bundle or asset.

Parameters

itemId: number

The id of the specified asset or bundle.

itemType: AvatarItemType

The AvatarItemType of the specified asset or bundle.


Returns

Whether the LocalPlayer has favorited the given bundle or asset.

GetInventory

Yields

Returns an InventoryPages object with information about owned items in the users inventory with the given AvatarAssetTypes.

The returned table includes the following fields:


[
{
"AssetName": "string",
"AssetId": 0,
"SerialNumber": 0,
"AssetType" : "string",
}
]

Parameters

assetTypes: Array

The AssetType that can will be checked for in the player's inventory.


Returns

GetItemDetails

Yields

This function returns the item details for the given item. It accepts two parameters - the first indicating the ID of the item being retrieved and the second indicating its Enum.ItemType.

Data returned in the format:


{
"IsForRent": true,
"ExpectedSellerId": 0,
"Owned": true,
"IsPurchasable": true,
"Id": 0,
"ItemType": "Asset",
"AssetType": "Image",
"BundleType": "BodyParts",
"Name": "string",
"Description": "string",
"ProductId": 0,
"Genres": [
"All"
],
"BundledItems": [
{
"Owned": true,
"Id": 0,
"Name": "string",
"Type": "string"
}
],
"ItemStatus": [
"New"
],
"ItemRestrictions": [
"ThirteenPlus"
],
"CreatorType": "User",
"CreatorTargetId": 0,
"CreatorName": "string",
"Price": 0,
"PremiumPricing": {
"PremiumDiscountPercentage": 0,
"PremiumPriceInRobux": 0
},
"LowestPrice": 0,
"PriceStatus": "string",
"UnitsAvailableForConsumption": 0,
"PurchaseCount": 0,
"FavoriteCount": 0
}

Parameters

itemId: number

The ID of the item whose details are being retrieved.

itemType: AvatarItemType

An enum value indicating the type of item whose details are being retrieved.


Returns

A table containing the item info for the retrieved item. See above for a sample table.

GetOutfitDetails

Yields

This function returns the outfit details for the given outfit. It accepts one parameter: the ID of the outfit. Access to this also depends on AvatarEditorService:PromptAllowInventoryReadAccess() being accepted by the user.

Data returns in the following format:


{
"Assets": [
{
"AssetType": {
"Id": 31,
"Name": "RightLeg"
}
"CurrentVersionId": 16447385805,
"Id": 11584239464,
"Name": "Anime Female - Right Leg"
}
],
"BodyColors": {
"HeadColor": Color3(204, 142, 105),
"LeftArmColor": Color3(204, 142, 105),
"LeftLegColor": Color3(204, 142, 105),
"RightArmColor": Color3(204, 142, 105),
"RightLegColor": Color3(204, 142, 105),
"TorsoColor": Color3(204, 142, 105)
},
"Id": 14703770624,
"IsEditable": true,
"Name": "Your Costume",
"OutfitType": "Avatar",
"PlayerAvatarType": "R15",
"Scale": {
"BodyType": 0,
"Depth": 1,
"Head": 1,
"Height": 1,
"Proportion": 0,
"Width": 1
},
}

Parameters

outfitId: number

The ID of the outfit whose details are being retrieved.


Returns

A table containing the outfit info for the retrieved outfit. See above for a sample table.

GetOutfits

Yields

This function returns outfit data for the Players.LocalPlayer. This would be used with Players:GetHumanoidDescriptionFromOutfitId() to update the players character to the outfit. Access to this would also depend on AvatarEditorService:PromptAllowInventoryReadAccess() being accepted by the user.

The returned table includes the following fields:


[
{
"Id": 0,
"Name": "string",
"IsEditable": true
}
]
NametypeDescription
idint
namestring
isEditableboolean

Parameters

outfitSource: OutfitSource
Default Value: "All"
outfitType: OutfitType
Default Value: "All"

Returns

GetRecommendedAssets

Yields

This function returns a list of recommended assets based on a given AssetType and asset id. Use this to gather a list of similar assets to the asset provided. Take a look at the code sample below for more information on possible usages for this function.

Data is in the format:


[
{
"Item": {
"AssetId": 0,
"Name": "string",
"Price": 0,
"PremiumPrice": 0,
},
"Creator": {
"CreatorId": 0,
"CreatorType": "string",
"Name": "string",
},
"Product": {
"Id": 0,
"PriceInRobux": 0,
"IsForSale": true,
"IsResellable": true,
"IsLimited": true,
"IsLimitedUnique": true,
"TotalPrivateSales": 0,
"OffsaleDeadline": "string",
"IsFree": true
}
}
]

Parameters

assetType: AvatarAssetType

The type of asset recommendations to retrieve recommendations for.

contextAssetId: number

The id of an asset with a type matching the provided assetType used for context when retrieving recommendations.

Default Value: 0

Returns

A list of recommendations based on the given AssetType.

Code Samples

Getting a Hat Recommendation

local AvatarEditorService = game:GetService("AvatarEditorService")
local assets = AvatarEditorService:GetRecommendedAssets(Enum.AvatarAssetType.Hat, 9255093)
for _, asset in ipairs(assets) do
print(asset.Item.Name)
end

GetRecommendedBundles

Yields

This function returns a list of recommended bundles for a given bundle id.

Data is in the format:


[
{
"Id": 0,
"Name": "string",
"Description": "string",
"BundleType": "string",
"Items": [
{
"Owned": true,
"Id": 0,
"Name": "string",
"Type": "string"
}
],
"Creator": {
"Id": 0,
"Name": "string",
"Type": "string"
},
"Product": {
"Id": 0,
"Type": "string",
"IsPublicDomain": true,
"IsForSale": true,
"PriceInRobux": 0,
"PremiumPricing": {
"PremiumDiscountPercentage": 0,
"PremiumPriceInRobux": 0
}
}
}
]

Parameters

bundleId: number

A list of recommended bundles.


Returns

The bundle ID that the recommended bundles will be returned for.

SearchCatalog

Yields

This function returns a CatalogPages object containing the result of the given search.

The returned data has the format:


[
{
"Id": 0,
"ItemType": "Asset",
"AssetType": "Image",
"BundleType": "BodyParts",
"Name": "string",
"Description": "string",
"ProductId": 0,
"Genres": [
"All"
],
"BundledItems": [
{
"Owned": true,
"Id": 0,
"Name": "string",
"Type": "string"
}
],
"ItemStatus": [
"New"
],
"ItemRestrictions": [
"ThirteenPlus"
],
"CreatorType": "User",
"CreatorTargetId": 0,
"CreatorName": "string",
"Price": 0,
"PremiumPricing": {
"PremiumDiscountPercentage": 0,
"PremiumPriceInRobux": 0
},
"LowestPrice": 0,
"PriceStatus": "string",
"UnitsAvailableForConsumption": 0,
"PurchaseCount": 0,
"FavoriteCount": 0
}
]

Parameters

searchParameters: CatalogSearchParams

An object containing the parameters used for the search.


Returns

Events

PromptAllowInventoryReadAccessCompleted

This event fires when the AvatarEditorService:PromptAllowInventoryReadAccess() prompt is responded to by the user. It can only return the Success or PermissionDenied enum statuses as it does not perform any web requests which could fail.

Parameters

The result of the prompt.


PromptCreateOutfitCompleted

This event fires when the PromptSaveOutfit operation is completed. It gives a status enum indicating whether the prompt succeeded, failed or permission was not granted by the user.

Parameters

The result of the prompt.

failureType: Variant

PromptDeleteOutfitCompleted

Fires when the PromptDeleteOutfit operation is completed. It gives a status enum indicating whether the prompt succeeded, failed or permission was not granted by the user.

Parameters

The result of the prompt.


PromptRenameOutfitCompleted

Fires when the PromptRenameOutfit operation is completed. It gives a status enum indicating whether the prompt succeeded, failed or permission was not granted by the user.

Parameters

The result of the prompt.


PromptSaveAvatarCompleted

This event fires when the AvatarEditorService:PromptSaveAvatar() operation is completed. It gives a status enum indicating whether the prompt succeeded, failed or permission was not granted by the user.

Parameters

The result of the prompt.

humanoidDescription: HumanoidDescription

PromptSetFavoriteCompleted

Fires when the AvatarEditorService:PromptSetFavorite() operation is completed. It gives a status enum indicating whether the prompt succeeded, failed or permission was not granted by the user.

Parameters

The result of the prompt.


PromptUpdateOutfitCompleted

Fires when the AvatarEditorService:PromptUpdateOutfit() operation is completed. It gives a status enum indicating whether the prompt succeeded, failed or permission was not granted by the user.

Parameters

The result of the prompt.