Source: Roblox Creator Hub · CC BY 4.0 · View source · Code samples: MIT Imported 2026-10-03. Formatting adapted for this site.
AvatarCreationService
Inherits from: Instance → Object
AvatarCreationService is a service that supports developer avatar creators, providing methods that support the prompting of avatar creation from within experiences.
Inherits from: Instance
Memory category: Instances
Tags: NotCreatable, Service
Methods
| Name | Type / Returns | Description |
|---|---|---|
| AvatarCreationService:AutoSetupAvatarAsync | string | Automatically sets up a custom Model and/or avatar accessories. |
| AvatarCreationService:GenerateAvatar2DPreviewAsync | string | Creates a 2D avatar preview and returns a previewId. |
| AvatarCreationService:GenerateAvatarAsync | string | Generates an avatar and returns a generationId. |
| AvatarCreationService:GetBatchTokenDetailsAsync | Array | Gets the avatar creation token details for a list of avatar creation tokens at once. |
| AvatarCreationService:GetValidationRules | Dictionary | Gets data regarding rules that assets must abide by to pass UGC validation. |
| AvatarCreationService:LoadAvatar2DPreviewAsync | EditableImage | Load an AvatarGeneration 2D preview on the client from a previewId. |
| AvatarCreationService:LoadGeneratedAvatarAsync | HumanoidDescription | Loads a generated avatar using an avatar generation ID. |
| AvatarCreationService:PrepareAvatarForPreviewAsync | () | Prepares in-experience avatar for preview. |
| AvatarCreationService:PromptCreateAvatarAssetAsync | Tuple | Prompts a Player to purchase and create an avatar asset from an Instance. |
| AvatarCreationService:PromptCreateAvatarAsync | Tuple | Prompts a Player to purchase and create an avatar from a HumanoidDescription. |
| AvatarCreationService:PromptSelectAvatarGenerationImageAsync | string | Prompt the Player to take a selfie and return the FileId. |
| AvatarCreationService:RequestAvatarGenerationSessionAsync | Tuple | Request an AvatarGeneration session for a Player. |
| AvatarCreationService:ValidateUGCAccessoryAsync | Tuple | Studio only. Runs UGC validation for an AccessoryType. |
| AvatarCreationService:ValidateUGCBodyPartAsync | Tuple | Studio only. Runs UGC validation for an BodyPart. |
| AvatarCreationService:ValidateUGCFullBodyAsync | Tuple | Studio only. Runs UGC validation for a whole body. |
Inherited from Instance
| Name | Type / Returns | Description |
|---|---|---|
| Instance:AddTag | () | Applies a tag to the instance. |
| Instance:children | Instances | Returns an array of the object's children. |
| Instance:ClearAllChildren | () | This method destroys all of an instance's children. |
| Instance:Clone | Instance | Create a copy of an instance and all its descendants, ignoring instances that are not Archivable. |
| Instance:clone | Instance | |
| Instance:Destroy | () | Sets the Instance.Parent property to nil, locks the Instance.Parent property, disconnects all connections, and calls Destroy() on all children. |
| Instance:destroy | () | |
| Instance:FindFirstAncestor | Instance? | Returns the first ancestor of the Instance whose Instance.Name is equal to the given name. |
| Instance:FindFirstAncestorOfClass | Instance? | Returns the first ancestor of the Instance whose Object.ClassName is equal to the given className. |
| Instance:FindFirstAncestorWhichIsA | Instance? | Returns the first ancestor of the Instance for whom Object:IsA() returns true for the given className. |
| Instance:FindFirstChild | Instance? | Returns the first child of the Instance found with the given name. |
| Instance:findFirstChild | Instance | |
| Instance:FindFirstChildOfClass | Instance? | Returns the first child of the Instance whose ClassName is equal to the given class name. |
| Instance:FindFirstChildWhichIsA | Instance? | Returns the first child of the Instance for whom Object:IsA() returns true for the given className. |
| Instance:FindFirstDescendant | Instance? | Returns the first descendant found with the given Instance.Name. |
| Instance:GetActor | Actor? | Returns the Actor associated with the Instance, if any. |
| Instance:GetAttribute | Variant | Returns the value which has been assigned to the given attribute name. |
| Instance:GetAttributeChangedSignal | RBXScriptSignal | Returns an event that fires when the given attribute changes. |
| Instance:GetAttributes | Dictionary | Returns a dictionary of the instance's attributes. |
| Instance:GetChildren | Instances | Returns an array containing all of the instance's children. |
| Instance:getChildren | Instances | |
| Instance:GetDebugId | string | Returns a coded string of the debug ID used internally by Roblox. |
| Instance:GetDescendants | Instances | Returns an array containing all of the descendants of the instance. |
| Instance:GetFullName | string | Returns a string describing the instance's ancestry. |
| Instance:GetStyled | Variant | Returns the styled or explicitly modified value of the specified property, or else the default property value if it hasn't been styled/modified. |
| Instance:GetStyledPropertyChangedSignal | RBXScriptSignal | Returns an event that fires when the given style property changes on the instance. |
| Instance:GetTags | Array | Gets an array of all tags applied to the instance. |
| Instance:HasTag | boolean | Check whether the instance has a given tag. |
| Instance:IsAncestorOf | boolean | Returns true if an Instance is an ancestor of the given descendant. |
| Instance:IsDescendantOf | boolean | Returns true if an Instance is a descendant of the given ancestor. |
| Instance:isDescendantOf | boolean | |
| Instance:IsPropertyModified | boolean | Returns true if the value stored in the specified property is not equal to the code-instantiated default. |
| Instance:QueryDescendants | Instances | Returns an array containing all descendants of the instance that match the selector string. |
| Instance:Remove | () | Sets the object's Parent to nil, and does the same for all its descendants. |
| Instance:remove | () | |
| Instance:RemoveTag | () | Removes a tag from the instance. |
| Instance:ResetPropertyToDefault | () | Resets a property to its default value. |
| Instance:SetAttribute | () | Sets the attribute with the given name to the given value. |
| Instance:WaitForChild | Instance | Returns the child of the Instance with the given name. If the child does not exist, it will yield the current thread until it does. |
Inherited from Object
| Name | Type / Returns | Description |
|---|---|---|
| Object:GetPropertyChangedSignal | RBXScriptSignal | Get an event that fires when a given property of the object changes. |
| Object:IsA | boolean | Returns true if an object's class matches or inherits from a given class. |
| Object:isA | boolean |
AvatarCreationService:AutoSetupAvatarAsync
Automatically sets up a custom Model as an avatar asset. This method returns a string generation ID which can be passed to LoadGeneratedAvatarAsync() to load the generated avatar and return a HumanoidDescription with all the generated instances and properties. The load method can be called on both the server and client, allowing the generated avatar to be loaded in both places (on the client for previewing, and on the server for saving the generated avatar to the player's inventory using PromptCreateAvatarAsync()).
Auto-setup has specific model requirements and accepts certain configurations of models. For more information, see Auto-setup requirements.
Note: this API requires the Enable Mesh / Image APIs setting to be turned on under Content Settings for your experience.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| player | Player | The Player that the avatar is being set up for. | |
| autoSetupParams | Dictionary | A table containing the arguments. Type: type AutoSetupAccessory = { AccessoryType: Enum.AccessoryType, IsLayered: bool, Instance: Model, } type AutoSetupParams = { Body: Model?, Accessories: {AutoSetupAccessory}, } | |
| progressCallback | Function? | Optional callback function that will be invoked periodically with a progressInfo table with the overall progress (from 0 to 1). Type: (progressInfo: { Progress: number }) -> () |
Returns
| Type | Description |
|---|---|
| string | A unique identifier for the generated avatar. |
| Field | Value |
|---|---|
| tags | ["Yields"] |
| security | None |
| thread safety | Unsafe |
| capabilities | ["DynamicGeneration"] |
Code samples: View on Creator Hub (AvatarCreationService-AutoSetupAvatarAsync).
AvatarCreationService:GenerateAvatar2DPreviewAsync
Creates a 2D avatar image preview, taking as input the FileId from PromptSelectAvatarGenerationImageAsync() and an optional text prompt. It returns a previewId which can be passed to LoadAvatar2DPreviewAsync() to retrieve the preview image on the client. This API can only be used on the game server.
Note: this API requires the Enable Mesh / Image APIs setting to be turned on under Content Settings for your experience.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| avatarGeneration2dPreviewParams | Dictionary | A table of arguments for 2D preview generation. Type: avatarGeneration2dPreviewParams: {SessionId: string, FileId: string, TextPrompt: string?} | |
| progressCallback | Function? | Optional callback function that will be invoked periodically with a progressInfo table with the overall progress (from 0 to 1). Type: (progressInfo: { Progress: number }) -> () |
Returns
| Type | Description |
|---|---|
| string | A string previewId |
| Field | Value |
|---|---|
| tags | ["Yields"] |
| security | None |
| thread safety | Unsafe |
| capabilities | ["DynamicGeneration"] |
Code samples: View on Creator Hub (AvatarCreationService-GenerateAvatar2DPreviewAsync).
AvatarCreationService:GenerateAvatarAsync
Generate an avatar from a preview and return the generationId. The LoadGeneratedAvatarAsync() method is then called to retrieve the generated HumanoidDescription avatar. This API can only be used on the game server.
Note: this API requires the Enable Mesh / Image APIs setting to be turned on under Content Settings for your experience.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| avatarGenerationParams | Dictionary | A table of arguments for generating an avatar. Type: avatarGenerationParams: {SessionId: string, PreviewId: string} | |
| progressCallback | Function? | Optional callback function that will be invoked periodically with a progressInfo table with the overall progress (from 0 to 1). Type: (progressInfo: { Progress: number }) -> () |
Returns
| Type | Description |
|---|---|
| string | A string generationId. |
| Field | Value |
|---|---|
| tags | ["Yields"] |
| security | None |
| thread safety | Unsafe |
| capabilities | ["DynamicGeneration"] |
Code samples: View on Creator Hub (AvatarCreationService-GenerateAvatarAsync).
AvatarCreationService:GetBatchTokenDetailsAsync
Gets the avatar creation token details for a list of avatar creation tokens at once (tokens are generated through the token creation process). Returns an array of avatar creation token details; each token detail is a dictionary with the fields indicated in the example result below:
{
["Name"] = "string",
["Description"] = "string",
["UniverseId"] = 0,
["CreatorId"] = 0,
["CreatorType"] = Enum.CreatorType.User,
["OnSale"] = true,
["Price"] = 0,
["OffSaleReasons"] = {
"string",
}
} Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| tokenIds | Array | The list of avatar creation token IDs to get details of. |
Returns
| Type | Description |
|---|---|
| Array | Array of avatar creation token details as outlined above. |
| Field | Value |
|---|---|
| tags | ["Yields"] |
| security | None |
| thread safety | Unsafe |
| capabilities | ["Monetization"] |
AvatarCreationService:GetValidationRules
Gets data regarding rules that assets must abide by to pass UGC validation. Validation is an essential step before creating avatars and there are various checks that occur, including mesh triangle limits, texture sizes, body part size limits, attachment positions, and more.
The returned dictionary of validation rules takes the following form:
{
["MeshRules"] = {
["BodyPartMaxTriangles"] = {
Enum.AssetType.DynamicHead: number,
Enum.AssetType.LeftArm: number,
Enum.AssetType.RightArm: number,
Enum.AssetType.Torso: number,
Enum.AssetType.LeftLeg: number,
Enum.AssetType.RightLeg: number,
},
["AccessoryMaxTriangles"]: number,
["MeshVertColor"]: Color3,
["CageMeshMaxDistanceFromRenderMesh"]: number,
},
["TextureRules"] = {
["MaxTextureSize"]: number,
},
["BodyPartRules"] = {
[Enum.AssetType.DynamicHead] = {
["Bounds"] = {
["Classic"] = {
["MinSize"]: Vector3,
["MaxSize"]: Vector3,
},
["ProportionsSlender"] = {
["MinSize"]: Vector3,
["MaxSize"]: Vector3,
},
["ProportionsNormal"] = {
["MinSize"]: Vector3,
["MaxSize"]: Vector3,
},
},
["SubParts"] = {
["Head"] = {
["NeckRigAttachment"] = {
["LowerBound"]: Vector3,
["UpperBound"]: Vector3,
},
["FaceFrontAttachment"] = {
["LowerBound"]: Vector3,
["UpperBound"]: Vector3,
},
["HatAttachment"] = {
["LowerBound"]: Vector3,
["UpperBound"]: Vector3,
},
["HairAttachment"] = {
["LowerBound"]: Vector3,
["UpperBound"]: Vector3,
},
["FaceCenterAttachment"] = {
["LowerBound"]: Vector3,
["UpperBound"]: Vector3,
},
},
},
},
[Enum.AssetType.LeftArm] = {
["Bounds"] = {
["Classic"] = {
["MinSize"]: Vector3,
["MaxSize"]: Vector3,
},
["ProportionsSlender"] = {
["MinSize"]: Vector3,
["MaxSize"]: Vector3,
},
["ProportionsNormal"] = {
["MinSize"]: Vector3,
["MaxSize"]: Vector3,
},
},
["SubParts"] = {
["LeftHand"] = {
["LeftWristRigAttachment"] = {
["LowerBound"]: Vector3,
["UpperBound"]: Vector3,
},
["LeftGripAttachment"] = {
["LowerBound"]: Vector3,
["UpperBound"]: Vector3,
},
},
["LeftUpperArm"] = {
["LeftShoulderRigAttachment"] = {
["LowerBound"]: Vector3,
["UpperBound"]: Vector3,
},
["LeftShoulderAttachment"] = {
["LowerBound"]: Vector3,
["UpperBound"]: Vector3,
},
["LeftElbowRigAttachment"] = {
["LowerBound"]: Vector3,
["UpperBound"]: Vector3,
},
},
["LeftLowerArm"] = {
["LeftElbowRigAttachment"] = {
["LowerBound"]: Vector3,
["UpperBound"]: Vector3,
},
["LeftWristRigAttachment"] = {
["LowerBound"]: Vector3,
["UpperBound"]: Vector3,
},
},
},
},
...
},
["AccessoryRules"] = {
[Enum.AssetType.HairAccessory] = {
["Attachments"] = {
{
["Size"]: Vector3,
["Offset"]: Vector3,
["Name"]: string,
},
},
["RigidAllowed"]: boolean,
},
...
},
["MakeupRules"] = {
["ReferenceCageMeshId"]: number,
["WrapTextureTransferUVBounds"] = {
["MinBound"]: Vector2,
["MaxBound"]: Vector2,
},
["ExcludeUVBounds"] = {
[Enum.AssetType.FaceMakeup] = {
["LeftEye"] = {
["MinBound"]: Vector2,
["MaxBound"]: Vector2,
},
["RightEye"] = {
["MinBound"]: Vector2,
["MaxBound"]: Vector2,
},
["Lips"] = {
["MinBound"]: Vector2,
["MaxBound"]: Vector2,
},
},
},
["IncludeUVBounds"] = {
[Enum.AssetType.LipMakeup] = {
["MinBound"]: Vector2,
["MaxBound"]: Vector2,
},
[Enum.AssetType.EyeMakeup] = {
["MinBound"]: Vector2,
["MaxBound"]: Vector2,
},
}
}
} Returns
| Type | Description |
|---|---|
| Dictionary | Dictionary of validation rules as detailed above. |
| Field | Value |
|---|---|
| tags | ["CustomLuaState"] |
| security | None |
| thread safety | Unsafe |
AvatarCreationService:LoadAvatar2DPreviewAsync
Load an AvatarGeneration 2D preview as an EditableImage on the client for the given previewId. This API can only be used on the client.
Note: this API requires the Enable Mesh / Image APIs setting to be turned on under Content Settings for your experience.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| previewId | string | Load the preview generated from GenerateAvatar2DPreviewAsync(). |
Returns
| Type | Description |
|---|---|
| EditableImage | An EditableImage containing the preview image. |
| Field | Value |
|---|---|
| tags | ["Yields"] |
| security | None |
| thread safety | Unsafe |
| capabilities | ["DynamicGeneration"] |
Code samples: View on Creator Hub (AvatarCreationService-LoadAvatar2DPreviewAsync).
AvatarCreationService:LoadGeneratedAvatarAsync
Loads a generated avatar using an avatar generation ID, as returned by AutoSetupAvatarAsync() or GenerateAvatarAsync(). The generated avatar will be returned as a HumanoidDescription with all the generated instances and properties. Mesh and texture assets will be provided as EditableMesh and EditableImage objects, respectively, to allow continued editing of the generated avatar.
This method can be called on both the server and client, allowing the generated avatar to be loaded in both places (on the client for previewing, and on the server for saving the generated avatar to the player's inventory using PromptCreateAvatarAsync()). Once the method has been invoked on both the client and server, the data associated with the generation ID will be erased and subsequent calls to his method with the same generation ID will fail.
Note: this API requires the Enable Mesh / Image APIs setting to be turned on under Content Settings for your experience.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| generationId | string | A unique string that identifies the generated avatar, as returned by AutoSetupAvatarAsync(). |
Returns
| Type | Description |
|---|---|
| HumanoidDescription | The HumanoidDescription of the generated avatar, which includes all the generated instances and properties. |
| Field | Value |
|---|---|
| tags | ["Yields"] |
| security | None |
| thread safety | Unsafe |
| capabilities | ["DynamicGeneration"] |
Code samples: View on Creator Hub (AvatarCreationService-LoadGeneratedAvatarAsync).
AvatarCreationService:PrepareAvatarForPreviewAsync
Triggers HSR generation and attachment point updating for in-experience avatar previews. This allows for previewing of avatars created in experience with layered clothing and accessories in the same way they will appear when published through PromptCreateAvatarAsync().
When developers use EditableMesh and WrapDeformer to modify avatars before publishing, the original HSR data may not accurately account for the new deformations. This method generates updated HSR data and corrects attachment points based on the WrapDeformer modifications, ensuring consistent preview and published avatar appearance.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| humanoidModel | Model | The Model containing MeshPart children with WrapDeformer instances that require HSR data updating for preview. |
Returns
| Type | Description |
|---|---|
| () | void |
| Field | Value |
|---|---|
| tags | ["Yields"] |
| security | None |
| thread safety | Unsafe |
| capabilities | ["AvatarAppearance"] |
AvatarCreationService:PromptCreateAvatarAssetAsync
Prompts a Player to purchase and create an avatar asset from an Instance. The price of the creation is dictated by the price attributed to the avatar creation token. This creation token is required for the purchasing and creation of the asset and can be generated by following the token creation process.
For avatar asset creation, the Instance is expected to include a new accessory to be created. This includes the following types: Hat, Hair, FaceAccessory, NeckAccessory, ShoulderAccessory, FrontAccessory, BackAccessory, WaistAccessory, TShirtAccessory, ShirtAccessory, PantsAccessory, JacketAccessory, SweaterAccessory, ShortsAccessory, DressSkirtAccessory.
To support this, the Instance should be an Accessory instance or contain an Accessory child instance. This should include a MeshPart child instance which makes up the accessory.
The avatar asset MeshPart will also need to include:
- An
EditableImage. - An
EditableMesh.
If creating a layered clothing accessory such as a shirt, the MeshPart should include a WrapDeformer with an EditableMesh.
Finally, the provided AvatarAssetType should match the creation type of the token and the type of Accessory for upload.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| tokenId | string | The ID of a creation token. The token must be valid in that the universe the method is called from is the same universe the token was created for. Furthermore, the token creator must maintain ID verification and Roblox Premium. To create a token for utilization in this API, follow the token creation process. The token's creation type must match the AvatarAssetType passed in to the method. | |
| player | Player | The Player intended to be presented with the creation prompt. | |
| assetInstance | Instance | The Instance of the avatar asset intended for creation. | |
| assetType | AvatarAssetType | The AvatarAssetType of the expected creation. This must match the creation type of the provided token. |
Returns
| Type | Description |
|---|---|
| Tuple | A tuple containing, in order: - An PromptCreateAssetResult indicating the result of the creation prompt. - A string result. In the case of PromptCreateAssetResult.Success, this will indicate the asset ID. In the case of any failure enum, this will indicate the resultant error message. |
| Field | Value |
|---|---|
| tags | ["Yields"] |
| security | None |
| thread safety | Unsafe |
Code samples: View on Creator Hub (AvatarCreationService-PromptCreateAvatarAssetAsync).
AvatarCreationService:PromptCreateAvatarAsync
Prompts a Player to purchase and create an avatar from a HumanoidDescription. The price of the creation is dictated by the price attributed to the avatar creation token. This avatar creation token is required for the purchasing and creation of the body and can be generated by following the token creation process.
For avatar creation, the HumanoidDescription is expected to include new assets to be created for each of the 6 body parts (Head, Torso, RightLeg, LeftLeg, RightArm, LeftArm). Optionally, it can also include a new Hair accessory.
To support this, the HumanoidDescription should include 6 BodyPartDescription children (one for each body part). For each, the BodyPartDescription.Instance property references a Folder which includes all of the MeshPart instances which make up the body part, for example a LeftArm folder which has LeftHand, LeftUpperArm, and LeftLowerArm MeshParts. The BodyPartDescription.BodyPart property should also be set to the relevant BodyPart.
Each body part MeshPart will also need to include:
- An
EditableImage. - A
WrapDeformerwith anEditableMesh.
If including an accessory such as hair, the HumanoidDescription should include a child AccessoryDescription where:
- The
AccessoryDescription.Instanceproperty references theAccessoryinstance. - The
AccessoryDescription.AccessoryTypeproperty is set to the relevantAccessoryType.
Finally, the HumanoidDescription should include the humanoid scales of BodyTypeScale, HeadScale, HeightScale, WidthScale, and ProportionScale. Be mindful of the scales that a base body is imported with so that they match the scales provided to the HumanoidDescription.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| tokenId | string | The ID of an avatar creation token. The token must be valid in that the universe the method is called from is the same universe the token was created for. Furthermore, the token creator must maintain ID verification and Roblox Premium. To create a token for utilization in this API, follow the token creation process. | |
| player | Player | The Player intended to be presented with the creation prompt. | |
| humanoidDescription | HumanoidDescription | The HumanoidDescription of the avatar intended for creation. |
Returns
| Type | Description |
|---|---|
| Tuple | A tuple containing, in order: - An PromptCreateAvatarResult indicating the result of the creation prompt. - A string result. In the case of PromptCreateAvatarResult.Success, this will indicate the bundle ID. In the case of any failure enum, this will indicate the resultant error message. - A secondary optional string result. In the case of PromptCreateAvatarResult.Success, this will indicate the outfit ID. In the case of any failure enum, this will be nil. |
| Field | Value |
|---|---|
| tags | ["Yields"] |
| security | None |
| thread safety | Unsafe |
| capabilities | ["AssetCreateUpdate","Monetization"] |
Code samples: View on Creator Hub (AvatarCreationService-PromptCreateAvatarAsync).
AvatarCreationService:PromptSelectAvatarGenerationImageAsync
Prompt the Player to take a selfie and return the FileId of the selfie. This FileId is then passed as an argument to GenerateAvatar2DPreviewAsync(). This API can only be used on the game server.
local AvatarCreationService = game:GetService("AvatarCreationService")
function promptSelectAvatarGenerationImage(player)
local pcallSuccess, result = pcall(function()
return AvatarCreationService:PromptSelectAvatarGenerationImageAsync(player)
end)
if not pcallSuccess then
errName, errDesc = unpack(string.split(result, ": "))
if errName == "SelfieConsentDenied" then
warn("Player must accept consent to use feature.")
else
warn("Failed to prompt for image: ", errDesc)
end
end
return result
end On failure, the result string has the format ErrorName: Error description, allowing the error type to be identified programmatically.
| Error name | Error description |
|---|---|
| `SelfieConsentDenied` | Selfie consent not accepted |
| `QRTooManyRequests` | Failure to generate QR url due to too many requests; please wait and try again later |
| `MediaPermissionsDenied` | Permissions not granted for taking photo |
| `FeatureUnavailable` | Feature not available for player |
| `GenerationInProgress` | Generation already in progress for player |
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| player | Player | The Player to prompt for taking a selfie. |
Returns
| Type | Description |
|---|---|
| string | A string FileId of the selfie on success, or an error string describing the reason for failure. |
| Field | Value |
|---|---|
| tags | ["Yields"] |
| security | None |
| thread safety | Unsafe |
| capabilities | ["SensitiveInput"] |
AvatarCreationService:RequestAvatarGenerationSessionAsync
Request an AvatarGeneration session for a Player. Information about the session is returned via the callback, including the SessionId which is passed to the GenerateAvatar2DPreviewAsync() and GenerateAvatarAsync() methods. Additional session information includes allowed 2d preview generations, allowed 3d avatar generations, and the session time. The method returns a Tuple with an RBXScriptConnection and estimated waitTime. The RBXScriptConnection allows canceling a session request. The estimated waitTime is used to provide the player an estimated time in seconds until the session will be ready. This API can only be used on the game server.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| player | Player | The Player to request an AvatarGeneration session for. | |
| callback | Function | Callback function that is invoked with a SessionInfo table, with information about the session. Type: (SessionInfo: { SessionId: string, Allowed2DGenerations: number, Allowed3DGenerations: number, SessionTime: number }) -> () |
Returns
| Type | Description |
|---|---|
| Tuple | A tuple containing a RBXScriptConnection that can be used to cancel the session request and the estimated wait time in seconds. |
| Field | Value |
|---|---|
| tags | ["Yields"] |
| security | None |
| thread safety | Unsafe |
| capabilities | ["DynamicGeneration"] |
Code samples: View on Creator Hub (AvatarCreationService-RequestAvatarGenerationSessionAsync).
AvatarCreationService:ValidateUGCAccessoryAsync
Studio only. Given a Player and Instance for an AccessoryType, determines if UGC validation passes.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| player | Player | The Player validation is completed for. | |
| accessory | Instance | The instance validation is run on. | |
| accessoryType | AccessoryType | The AccessoryType the instance is expected to be. |
Returns
| Type | Description |
|---|---|
| Tuple | A tuple containing, in order: - A boolean indicating if validation was successful for the accessory. - An optional table of strings. This includes failure reasons if validation was unsuccessful; otherwise nil if validation was successful. |
| Field | Value |
|---|---|
| tags | ["Yields"] |
| security | None |
| thread safety | Unsafe |
AvatarCreationService:ValidateUGCBodyPartAsync
Studio only. Given a Player and Instance for an BodyPart, determines if UGC validation passes. The instance parameter is expected as a Folder in the following example format with relevant MeshParts:
LeftArm(Folder)
However, if the expected bodyPart is BodyPart.Head, the function takes a singular Head MeshPart directly.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| player | Player | The Player validation is completed for. | |
| instance | Instance | The instance validation is run on. | |
| bodyPart | BodyPart | BodyPart the instance is expected to be. |
Returns
| Type | Description |
|---|---|
| Tuple | A tuple containing, in order: - A boolean indicating if validation was successful for the body part. - An optional table of strings. This includes failure reasons if validation was unsuccessful; otherwise nil if validation was successful. |
| Field | Value |
|---|---|
| tags | ["Yields"] |
| security | None |
| thread safety | Unsafe |
AvatarCreationService:ValidateUGCFullBodyAsync
Studio only. Given a Player and HumanoidDescription, all instances in the HumanoidDescription will be validated.
The HumanoidDescription is expected to include instances set on BodyPartDescription children for each of the six required BodyPart values. Optionally, it can include instances set on AccessoryDescription children for any supported AccessoryType.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| player | Player | The Player validation is completed for. | |
| humanoidDescription | HumanoidDescription | HumanoidDescription representing the body that validation is run on. |
Returns
| Type | Description |
|---|---|
| Tuple | A tuple containing, in order: - A boolean indicating if validation was successful for the body. - An optional table of strings. This includes failure reasons if validation was unsuccessful; otherwise nil if validation was successful. |
| Field | Value |
|---|---|
| tags | ["Yields"] |
| security | None |
| thread safety | Unsafe |
Events
| Name | Type / Returns | Description |
|---|---|---|
| AvatarCreationService.AvatarAssetModerationCompleted | Fires when an in-experience-created avatar asset's moderation status has been updated from pending. | |
| AvatarCreationService.AvatarModerationCompleted | Fires when an in-experience-created avatar's moderation status has been updated from pending. | |
| AvatarCreationService.AvatarOutfitModerationCompleted | Fires on the client when moderation completes for an in-experience-created outfit. |
Inherited from Instance
| Name | Type / Returns | Description |
|---|---|---|
| Instance.AncestryChanged | Fires when the Instance.Parent property of this object or one of its ancestors is changed. | |
| Instance.AttributeChanged | Fires whenever an attribute is changed on the Instance. | |
| Instance.ChildAdded | Fires after an object is parented to this Instance. | |
| Instance.childAdded | ||
| Instance.ChildRemoved | Fires after a child is removed from this Instance. | |
| Instance.DescendantAdded | Fires after a descendant is added to the Instance. | |
| Instance.DescendantRemoving | Fires immediately before a descendant of the Instance is removed. | |
| Instance.Destroying | Fires immediately before (or is deferred until after) the instance is destroyed via Instance:Destroy(). | |
| Instance.StyledPropertiesChanged | Fires whenever any style property is changed on the instance, including when a property is set to nil. |
Inherited from Object
| Name | Type / Returns | Description |
|---|---|---|
| Object.Changed | Fires immediately after a property of the object changes, with some limitations. |
AvatarCreationService.AvatarAssetModerationCompleted
Fires when an in-experience-created avatar asset's moderation status has been updated from pending. This event provides a streamlined way to know when an avatar asset created through PromptCreateAvatarAssetAsync() has completed the moderation process and is ready for use in-experience.
Note that this event only fires for avatar assets created within the current experience and will trigger when the ModerationStatus changes from NotReviewed to any other status. The event fires on the client only.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| assetId | int64 | The asset ID of the asset that has completed moderation. | |
| moderationStatus | ModerationStatus | The final ModerationStatus result after moderation completed. |
| Field | Value |
|---|---|
| security | None |
| capabilities | ["DynamicGeneration"] |
Code samples: View on Creator Hub (AvatarCreationService-AvatarAssetModerationCompleted).
AvatarCreationService.AvatarModerationCompleted
Deprecated. This event is deprecated. Use AvatarCreationService.AvatarOutfitModerationCompleted instead; the replacement event supports avatar outfits and other in-experience-created outfit types.
Fires when an in-experience-created avatar's moderation status has been updated from pending. This event provides a streamlined way to know when an avatar created through PromptCreateAvatarAsync() has completed the moderation process and is ready for use in-experience.
Note that this event only fires for avatars created within the current experience and will trigger when the ModerationStatus changes from NotReviewed to any other status. The event fires on the client only. GetOutfitDetailsAsync can be used on the server to verify the current moderation status if needed.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| outfitId | int64 | The outfit ID of the avatar that has completed moderation. | |
| moderationStatus | ModerationStatus | The final ModerationStatus result after moderation completion. |
| Field | Value |
|---|---|
| security | None |
| capabilities | ["DynamicGeneration"] |
AvatarCreationService.AvatarOutfitModerationCompleted
Fires on the client when an in-experience-created outfit's moderation status changes from NotReviewed to another status. Use this event for any in-experience-created outfit type. Current outfit creation flows include PromptCreateAvatarAsync(). Future in-experience outfit types will use this event as well (AvatarModerationCompleted is deprecated).
Use outfitType to determine the kind of outfit that completed moderation. This event is informational: an outfit cannot be used until its moderation status permits it.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| outfitId | int64 | The outfit ID of the outfit that has completed moderation. | |
| moderationStatus | ModerationStatus | The final ModerationStatus result after moderation completion. | |
| outfitType | OutfitType | The OutfitType of the moderated outfit. |
| Field | Value |
|---|---|
| security | None |
| capabilities | ["DynamicGeneration"] |
Properties
Inherited from Instance
| Name | Type / Returns | Description |
|---|---|---|
| Instance.Archivable | boolean | Determines if an Instance and its descendants can be cloned using Instance:Clone(), and can be saved/published. |
| Instance.archivable | boolean | |
| Instance.Capabilities | SecurityCapabilities | The set of capabilities allowed to be used for scripts inside this container. |
| Instance.IsInSandbox | boolean | Indicates whether the instance is inside a sandboxed container. |
| Instance.Name | string | A non-unique identifier of the Instance. |
| Instance.Parent | Instance | Determines the hierarchical parent of the Instance. |
| Instance.PredictionMode | PredictionMode | Reflects the client-side prediction mode applied to the instance under server-authoritative physics. |
| Instance.RobloxLocked | boolean | A deprecated property that used to protect CoreGui objects. |
| Instance.Sandboxed | boolean | When enabled, the instance can only access abilities in its Capabilities list. |
| Instance.UniqueId | UniqueId | A unique identifier for the instance. |
Inherited from Object
| Name | Type / Returns | Description |
|---|---|---|
| Object.ClassName | string | A read-only string representing the class this Object belongs to. |
| Object.className | string |