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

Events

OpenPromptSetFavorite(itemId: number, itemType: AvatarItemType, shouldFavorite: boolean): RBXScriptSignal  


OpenPromptUpdateOutfit(outfitId: number, humanoidDescription: HumanoidDescription, rigType: HumanoidRigType): RBXScriptSignal  



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.

Methods

NoPromptCreateOutfit(humanoidDescription: HumanoidDescription, rigType: HumanoidRigType, name: string): boolean  


NoPromptRenameOutfit(outfitId: number, name: string): boolean  


NoPromptSaveAvatar(humanoidDescription: HumanoidDescription, rigType: HumanoidRigType, saveDict: table, gearAssetId: number): boolean  


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


NoPromptUpdateOutfit(outfitId: number, humanoidDescription: HumanoidDescription, rigType: HumanoidRigType): boolean  


PerformCreateOutfitWithDescription(humanoidDescription: HumanoidDescription, name: string): void  


PerformRenameOutfit(name: string): void  


PerformSaveAvatarWithDescription(humanoidDescription: HumanoidDescription, addedAssets: Array, removedAssets: Array): void  


PerformSetFavorite(): void  


PerformUpdateOutfit(humanoidDescription: HumanoidDescription): void  



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): void  

Prompts the Players.LocalPlayer to delete the given outfit.

PromptRenameOutfit(outfitId: number): void  

Prompts the Players.LocalPlayer to rename the given outfit.

PromptSaveAvatar(humanoidDescription: HumanoidDescription, rigType: HumanoidRigType): void  

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): void  

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

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

Prompts the Players.LocalPlayer to update the given outfit.

SetAllowInventoryReadAccess(inventoryReadAccessGranted: boolean): void  



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.

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 recommendations based on the given AssetType.

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.

Properties

Events

OpenAllowInventoryReadAccess

Roblox Script Security

OpenPromptCreateOufit

Roblox Script Security

Parameters

humanoidDescription: HumanoidDescription

OpenPromptDeleteOutfit

Roblox Script Security

Parameters

outfitId: number

OpenPromptRenameOutfit

Roblox Script Security

Parameters

outfitId: number

OpenPromptSaveAvatar

Roblox Script Security

Parameters

humanoidDescription: HumanoidDescription

OpenPromptSetFavorite

Roblox Script Security

Parameters

itemId: number
itemType: AvatarItemType
shouldFavorite: boolean

OpenPromptUpdateOutfit

Roblox Script Security

Parameters

outfitId: number
humanoidDescription: HumanoidDescription

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.


Methods

GetAccessoryType

Parameters

avatarAssetType: AvatarAssetType

NoPromptCreateOutfit

Roblox Script Security

Parameters

humanoidDescription: HumanoidDescription
name: string

Returns

NoPromptDeleteOutfit

Roblox Script Security

Parameters

outfitId: number

Returns

NoPromptRenameOutfit

Roblox Script Security

Parameters

outfitId: number
name: string

Returns

NoPromptSaveAvatar

Roblox Script Security

Parameters

humanoidDescription: HumanoidDescription
saveDict: table
gearAssetId: number
Default Value: "0"

Returns

NoPromptSetFavorite

Roblox Script Security

Parameters

itemId: number
itemType: AvatarItemType
shouldFavorite: boolean

Returns

NoPromptUpdateOutfit

Roblox Script Security

Parameters

outfitId: number
humanoidDescription: HumanoidDescription

Returns

PerformCreateOutfitWithDescription

void
Roblox Script Security

Parameters

humanoidDescription: HumanoidDescription
name: string

Returns

void

PerformDeleteOutfit

void
Roblox Script Security

Returns

void

PerformRenameOutfit

void
Roblox Script Security

Parameters

name: string

Returns

void

PerformSaveAvatarWithDescription

void
Roblox Script Security

Parameters

humanoidDescription: HumanoidDescription
addedAssets: Array
removedAssets: Array

Returns

void

PerformSetFavorite

void
Roblox Script Security

Returns

void

PerformUpdateOutfit

void
Roblox Script Security

Parameters

humanoidDescription: HumanoidDescription

Returns

void

PromptAllowInventoryReadAccess

void

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

void

No return.

PromptCreateOutfit

void

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

void

No return.

PromptDeleteOutfit

void

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

void

No return.

PromptRenameOutfit

void

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

void

No return.

PromptSaveAvatar

void

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

void

No return.

PromptSetFavorite

void

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

void

No return.

PromptUpdateOutfit

void

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

void

SetAllowInventoryReadAccess

void
Roblox Script Security

Parameters

inventoryReadAccessGranted: boolean

Returns

void

SignalCreateOutfitFailed

void
Roblox Script Security

Returns

void

SignalCreateOutfitPermissionDenied

void
Roblox Script Security

Returns

void

SignalDeleteOutfitFailed

void
Roblox Script Security

Returns

void

SignalDeleteOutfitPermissionDenied

void
Roblox Script Security

Returns

void

SignalRenameOutfitFailed

void
Roblox Script Security

Returns

void

SignalRenameOutfitPermissionDenied

void
Roblox Script Security

Returns

void

SignalSaveAvatarFailed

void
Roblox Script Security

Returns

void

SignalSaveAvatarPermissionDenied

void
Roblox Script Security

Returns

void

SignalSetFavoriteFailed

void
Roblox Script Security

Returns

void

SignalSetFavoritePermissionDenied

void
Roblox Script Security

Returns

void

SignalUpdateOutfitFailed

void
Roblox Script Security

Returns

void

SignalUpdateOutfitPermissionDenied

void
Roblox Script Security

Returns

void

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

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:


1{
2 "PlayerAvatarTypes": [
3 "R6"
4 ],
5 "Scales": {},
6 "WearableAssetTypes": [
7 {
8 "MaxNumber": 0,
9 "Id": 0,
10 "Name": "string"
11 }
12 ],
13 "BodyColorsPalette": [
14 {
15 "BrickColorId": 0,
16 "NexColor": "string",
17 "Name": "string"
18 }
19 ],
20 "BasicBodyColorsPalette": [
21 {
22 "BrickColorId": 0,
23 "HexColor": "string",
24 "Name": "string"
25 }
26 ],
27 "MinimumDeltaEBodyColorDifference": 0,
28 "ProportionsAndBodyTypeEnabledForUser": true,
29 "DefaultClothingAssetLists": {
30 "DefaultShirtAssetIds": [
31 0
32 ],
33 "DefaultPantAssetIds": [
34 0
35 ]
36 },
37 "BundlesEnabledForUser": true,
38 "EmotesEnabledForUser": true
39}
40

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:


1 {
2 "AssetType" = "string",
3 "CreatorName" = "string",
4 "CreatorTargetId" = 0,
5 "CreatorType" = "string",
6 "Description" = "string",
7 "FavoriteCount" = 0,
8 "Genres" = [
9 "All"
10 ],
11 "Id" = 0,
12 "ItemRestrictions" = [
13 "Limited"
14 ],
15 "ItemStatus": [
16 "New"
17 ],
18 "ItemType" = "string",
19 "LowestPrice" = 0,
20 "Name" = "string",
21 "Price" = 0,
22 "ProductId" = 0
23 }
24```.
25

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:


1[
2 {
3 "AssetName": "string",
4 "AssetId": 0,
5 "SerialNumber": 0,
6 "AssetType" : "string",
7 }
8]
9

Parameters

assetTypes: Array

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


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:


1{
2 "IsForRent": true,
3 "ExpectedSellerId": 0,
4 "Owned": true,
5 "IsPurchasable": true,
6 "Id": 0,
7 "ItemType": "Asset",
8 "AssetType": "Image",
9 "BundleType": "BodyParts",
10 "Name": "string",
11 "Description": "string",
12 "ProductId": 0,
13 "Genres": [
14 "All"
15 ],
16 "BundledItems": [
17 {
18 "Owned": true,
19 "Id": 0,
20 "Name": "string",
21 "Type": "string"
22 }
23 ],
24 "ItemStatus": [
25 "New"
26 ],
27 "ItemRestrictions": [
28 "ThirteenPlus"
29 ],
30 "CreatorType": "User",
31 "CreatorTargetId": 0,
32 "CreatorName": "string",
33 "Price": 0,
34 "PremiumPricing": {
35 "PremiumDiscountPercentage": 0,
36 "PremiumPriceInRobux": 0
37 },
38 "LowestPrice": 0,
39 "PriceStatus": "string",
40 "UnitsAvailableForConsumption": 0,
41 "PurchaseCount": 0,
42 "FavoriteCount": 0
43}
44

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.

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:


1[
2 {
3 "Id": 0,
4 "Name": "string",
5 "IsEditable": true
6 }
7]
8
NametypeDescription
idint
namestring
isEditableboolean

Parameters

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

GetRecommendedAssets

Yields

This function returns a list of recommendations based on the given AssetType. Take a look at the code sample below for more information on possible usages for this function.

Data is in the format:


1[
2 {
3 "Item": {
4 "AssetId": 0,
5 "Name": "string",
6 "Price": 0,
7 "PremiumPrice": 0,
8 "AbsoluteUrl": "string",
9 "AudioUrl": "string"
10 },
11 "Creator": {
12 "CreatorId": 0,
13 "CreatorType": "string",
14 "Name": "string",
15 "CreatorProfileLink": "string"
16 },
17 "Product": {
18 "Id": 0,
19 "PriceInRobux": 0,
20 "IsForSale": true,
21 "IsPublicDomain": true,
22 "IsResellable": true,
23 "IsLimited": true,
24 "IsLimitedUnique": true,
25 "SerialNumber": 0,
26 "IsRental": true,
27 "RentalDurationInHours": 0,
28 "BcRequirement": 0,
29 "TotalPrivateSales": 0,
30 "SellerId": 0,
31 "SellerName": "string",
32 "LowestPrivateSaleUserAssetId": 0,
33 "IsXboxExclusiveItem": true,
34 "OffsaleDeadline": "string",
35 "NoPriceText": "string",
36 "IsFree": true
37 }
38 }
39]
40

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

1local AvatarEditorService = game:GetService("AvatarEditorService")
2
3local assets = AvatarEditorService:GetRecommendedAssets(Enum.AvatarAssetType.Hat, 9255093)
4
5for _, asset in ipairs(assets) do
6 print(asset.Item.Name)
7end

GetRecommendedBundles

Yields

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

Data is in the format:


1[
2 {
3 "Id": 0,
4 "Name": "string",
5 "Description": "string",
6 "BundleType": "string",
7 "Items": [
8 {
9 "Owned": true,
10 "Id": 0,
11 "Name": "string",
12 "Type": "string"
13 }
14 ],
15 "Creator": {
16 "Id": 0,
17 "Name": "string",
18 "Type": "string"
19 },
20 "Product": {
21 "Id": 0,
22 "Type": "string",
23 "IsPublicDomain": true,
24 "IsForSale": true,
25 "PriceInRobux": 0,
26 "PremiumPricing": {
27 "PremiumDiscountPercentage": 0,
28 "PremiumPriceInRobux": 0
29 }
30 }
31 }
32]
33

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:


1[
2 {
3 "Id": 0,
4 "ItemType": "Asset",
5 "AssetType": "Image",
6 "BundleType": "BodyParts",
7 "Name": "string",
8 "Description": "string",
9 "ProductId": 0,
10 "Genres": [
11 "All"
12 ],
13 "BundledItems": [
14 {
15 "Owned": true,
16 "Id": 0,
17 "Name": "string",
18 "Type": "string"
19 }
20 ],
21 "ItemStatus": [
22 "New"
23 ],
24 "ItemRestrictions": [
25 "ThirteenPlus"
26 ],
27 "CreatorType": "User",
28 "CreatorTargetId": 0,
29 "CreatorName": "string",
30 "Price": 0,
31 "PremiumPricing": {
32 "PremiumDiscountPercentage": 0,
33 "PremiumPriceInRobux": 0
34 },
35 "LowestPrice": 0,
36 "PriceStatus": "string",
37 "UnitsAvailableForConsumption": 0,
38 "PurchaseCount": 0,
39 "FavoriteCount": 0
40 }
41]
42

Parameters

searchParameters: CatalogSearchParams

An object containing the parameters used for the search.