Avatar Editor Service | Documentation - Roblox Creator Hub (2024)

The Avatar Editor Service lets you access and make changes to a user's avatar within an experience. The Avatar Editor Service can also access a user's inventory and the Marketplace to save outfits and purchase avatar items to the user's account.

We recommend implementing the Avatar Editor Service with an in-game avatar editor for a complete character customization experience. See the Simple Avatar Editor Demo reference place for an example of this feature.

To begin using the Avatar Editor Service, you must first request access to the user's inventory. After access is successfully granted, you can perform the following actions:

Requesting Access

To begin accessing a user's inventory, you need to prompt the user to allow access through PromptAllowInventoryReadAccess(). You need to perform this request once per session.

Use the following code sample to initiate the access prompt and listen for the user response:

local AvatarEditorService = game:GetService("AvatarEditorService")

AvatarEditorService:PromptAllowInventoryReadAccess()

local result = AvatarEditorService.PromptAllowInventoryReadAccessCompleted:Wait()

if result == Enum.AvatarPromptResult.Success then

-- Access granted!

end

The user receives the following prompt:

Avatar Editor Service | Documentation - Roblox Creator Hub (1)

Once the user accepts the prompt, the AvatarEditorService can begin accessing the user's inventory.

Reading User Inventory

Once access is granted by the user, you can read their inventory with the GetInventory() function, supplying an array of AvatarAssetTypes to filter by. This function returns an InventoryPages object containing the user owned items.

Use the following code sample to print a list of specific accessories in a user's inventory:

local AvatarEditorService = game:GetService("AvatarEditorService")

AvatarEditorService:PromptAllowInventoryReadAccess()

local result = AvatarEditorService.PromptAllowInventoryReadAccessCompleted:Wait()

if result == Enum.AvatarPromptResult.Success then

-- Access granted!

local assetTypes = {

Enum.AvatarAssetType.BackAccessory,

Enum.AvatarAssetType.ShoulderAccessory,

Enum.AvatarAssetType.WaistAccessory

}

local pagesObject = AvatarEditorService:GetInventory(assetTypes)

local currentPage = pagesObject:GetCurrentPage()

for i, item in currentPage do

print(item)

end

end

Searching the Marketplace

AvatarEditorService includes functions and events which let you search the Roblox catalog. To search, supply your query with a CatalogSearchParams object that includes one or more of the following properties:

PropertyDescription
AssetTypesAn array of Enum.AvatarAssetType such as Enum.AvatarAssetType.BackAccessory.
BundleTypesAn array of Enum.BundleType such as Enum.BundleType.BodyParts.
CategoryFilterA Enum.CatalogCategoryFilter describing the various catalog categories like "Featured" or "Community Creations". By default this is set to Enum.CatalogCategoryFilter.None
MaxPriceAn integer describing the maximum price to filter.
MinPriceAn integer describing the minimum price to filter. By default, MinPrice is 0.
SearchKeywordA string to query against item descriptions in the catalog.
SortTypeA Enum.CatalogSortType that describes how the results are ordered. By default this is set to Enum.CatalogSortType.Relevance.
IncludeOffSaleA boolean describing whether the results of the search include off sale items. By default this is set to false.
CreatorIdAn integer to specify a given creator. You can use either a UserId or a GroupId.
CreatorNameA string used to search by items created by a given creator. You can use either a User Name or a Group Name.

The following code sample constructs a CatalogSearchParams object for Back and Shoulder asset types, and passes that through a SearchCatalog() call:

local AvatarEditorService = game:GetService("AvatarEditorService")

local catalogSearchParams = CatalogSearchParams.new()

local assetTypes = {

Enum.AvatarAssetType.BackAccessory,

Enum.AvatarAssetType.ShoulderAccessory

}

catalogSearchParams.AssetTypes = assetTypes

local pagesObject =

--This function returns a CatalogPages object containing the results.

AvatarEditorService:SearchCatalog(catalogSearchParams)

local currentPage = pagesObject:GetCurrentPage()

for i, item in currentPage do

print(item)

end

Saving Avatars and Outfits

When used alongside an in-game avatar editor, AvatarEditorService can save and update avatar items and outfits to the Roblox platform. Users don't receive catalog items they don't own when saving an avatar or outfit.

Any HumanoidDescription can be saved to the user's current avatar with PromptSaveAvatar(). This may include:

  • Pre-defined avatar configurations that you've built using existing catalog items.

  • Any configuration that the user has chosen through an in-game avatar editor.

Avatar Editor Service | Documentation - Roblox Creator Hub (2)

Since AvatarEditorService:PromptSaveAvatar() does not yield, you can get the result by listening to the AvatarEditorService.PromptSaveAvatarCompleted event.

The following code will save a current HumanoidDescription using PromptSaveAvatar() and checks for a successful AvatarEditorService.PromptSaveAvatarCompleted event:

local AvatarEditorService = game:GetService("AvatarEditorService")

local Players = game:GetService("Players")

local player = Players.LocalPlayer

local character = player.Character or player.CharacterAdded:Wait()

local humanoid = character:WaitForChild("Humanoid")

local currentDescription = humanoid:GetAppliedDescription()

AvatarEditorService:PromptSaveAvatar(currentDescription, humanoid.RigType)

local result = AvatarEditorService.PromptSaveAvatarCompleted:Wait()

if result == Enum.AvatarPromptResult.Success then

-- Avatar saved!

end

To save any HumanoidDescription as an outfit (without overwriting the user's current avatar), use AvatarEditorService:PromptCreateOutfit().

Avatar Editor Service | Documentation - Roblox Creator Hub (3)

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

The following code sample creates an outfit with AvatarEditorService:PromptCreateOutfit() and listens for a successful AvatarEditorService.PromptCreateOutfitCompleted event:

local AvatarEditorService = game:GetService("AvatarEditorService")

local Players = game:GetService("Players")

local player = Players.LocalPlayer

local character = player.Character or player.CharacterAdded:Wait()

local humanoid = character:WaitForChild("Humanoid")

local currentDescription = humanoid:GetAppliedDescription()

AvatarEditorService:PromptCreateOutfit(currentDescription, humanoid.RigType)

local result = AvatarEditorService.PromptCreateOutfitCompleted:Wait()

if result == Enum.AvatarPromptResult.Success then

-- Outfit saved!

end

Purchasing Items

When saving either an avatar or an outfit that uses catalog items, the user doesn't receive any items that they do not own. Before saving an avatar or outfit, check if the user owns the asset with MarketplaceService:PlayerOwnsAsset() and provide them with an option to purchase the item with MarketplaceService:PromptPurchase().

If you don't wish to implement item purchases, you can instead allow users to favorite non-owned items with AvatarEditorService:PromptSetFavorite().

Be aware that you can't earn Robux commissions if the user decides to purchase those items outside of your experience.

Avatar Editor Service | Documentation - Roblox Creator Hub (2024)
Top Articles
Fiesta Pork Chops and Rice Bake Recipe
Scottish Shortbread Biscuits Recipe
Varsity Competition Results 2022
Www Craigslist Com Juneau
Ess Compass Associate Portal Login
RS3 Mining Training Guide - 1-99/120 | Gaming Elephant
Gma Deals And Steals December 5 2022
Dr Frita Mcrae Fisher Husband
Calling All Competitors Wow
Osage actor talks Scorsese, 'Big Uncle Energy' and 'Killers of the Flower Moon'
Oracle Holiday Calendar 2022
Configuring Fail2ban with Traefik
Wall Street Journal Currency Exchange Rates Historical
At 25 Years, Understanding The Longevity Of Craigslist
Krystal Murphy Below Deck Net Worth
Ingersoll Greenwood Funeral Home Obituaries
Spicy Korean Gochujang Tofu (Vegan)
Pachuvum Athbutha Vilakkum Movie Download Telegram Link
211475039
Best Amsterdam Neighborhoods for Expats: Top 9 Picks
University Of Michigan Paging System
Kuronime List
My Time Banner Health
How to Be an Extra in a Movie (and What to Expect)
Https //Myapps.microsoft.com Portal
Fortnite Chapter 5: All you need to know!
Pirates Point Lake Of The Ozarks
How to Get Into UCLA Medical School: Requirements and Strategies — Shemmassian Academic Consulting
02080797947
Ansos Umm
T&J Agnes Theaters
Lehigh Wheelmen Meetup
Ralph Macchio Conservative
Keanu Reeves cements his place in action genre with ‘John Wick: Chapter 4’
Mission Impossible 7 Showtimes Near Regal Willoughby Commons
Oklahoma Craigslist Pets
Texas Motors Specialty Photos
No Good Dirty Scoundrel Crossword
Road Techs
Grasons Estate Sales Tucson
Obtaining __________ Is A Major And Critical Closure Activity.
Destep: 10 tips voor de scherpste destep-analyse ooit!
22 alternatieve zoekmachines om nu te gebruiken
Autozone On 7 Mile And Hubbell
1Wangrui4
SF bay area cars & trucks "chevrolet 50" - craigslist
Select Costco Stores: Insta360 X3 5.7K 360° Action Camera Adventure Bundle $100 (In-Store Purchase Only)
Unblocked Games 67 Ez
New Application Instructions · Government Portal
3220 Nevada Terrace Ottawa Ks 66067
Craigslist Sf Jobs Food And Beverage
49 CFR Part 581 -- Bumper Standard
Latest Posts
Article information

Author: The Hon. Margery Christiansen

Last Updated:

Views: 6176

Rating: 5 / 5 (50 voted)

Reviews: 81% of readers found this page helpful

Author information

Name: The Hon. Margery Christiansen

Birthday: 2000-07-07

Address: 5050 Breitenberg Knoll, New Robert, MI 45409

Phone: +2556892639372

Job: Investor Mining Engineer

Hobby: Sketching, Cosplaying, Glassblowing, Genealogy, Crocheting, Archery, Skateboarding

Introduction: My name is The Hon. Margery Christiansen, I am a bright, adorable, precious, inexpensive, gorgeous, comfortable, happy person who loves writing and wants to share my knowledge and understanding with you.