Source: Roblox Creator Hub · CC BY 4.0 · View source · Code samples: MIT Imported 2026-10-03. Formatting adapted for this site.
GenerationService
Inherits from: Instance → Object
GenerationService enables you to generate 3D objects from text prompts using Roblox's Cube 3D foundation model. This enables the generation of objects like environmental props in-experience, as well as fully functional models like vehicles that drive, planes that fly, and weapons that shoot.
Inherits from: Instance
Memory category: Instances
Tags: NotCreatable, Service
Methods
| Name | Type / Returns | Description |
|---|---|---|
| GenerationService:GenerateMeshAsync | Tuple | Starts the generation of a new 3D mesh from a text prompt and returns unique IDs used to track and retrieve the result. |
| GenerationService:GenerateModelAsync | Tuple | Enables generation of multi-mesh geometries according to provided inputs and a schema. |
| GenerationService:LoadGeneratedMeshAsync | MeshPart | Retrieves and loads a mesh generated by GenerationService:GenerateMeshAsync() using the provided generationId. |
| GenerationService:SegmentMeshAsync | Tuple | Segments an existing MeshPart into multiple named parts according to a provided schema, returning a Model organized by the schema groups. |
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 |
GenerationService:GenerateMeshAsync
Deprecated. This method is scheduled for future deprecation. Explore GenerateModelAsync() as a newer method.
Starts the generation of a new 3D mesh from a text prompt and returns unique IDs used to track and retrieve the result. Must be called from server scripts. You can optionally receive intermediate results, such as the untextured mesh, by providing an intermediateResultCallback function.
After the generation is complete, use LoadGeneratedMeshAsync() to load and display the generated mesh.
Error Codes
| Error | Description | Recommended action |
|---|---|---|
| Rate limit exceeded | The maximum number of mesh generations has been exceeded for the minute. | Wait until the rate limit resets. |
| Moderation failed | The mesh generation was flagged for moderation. | Review and modify the prompt to ensure it adheres to Roblox's moderation guidelines. |
| Internal server error | An unexpected issue occurred on the server. | Retry the request later or check server status for issues. |
| Character limit exceeded | The input prompt length for this generation request exceeded the limit. | Reduce the number of characters in the Prompt string of the input dictionary. |
| Service overloaded | The service is overloaded. | Retry the request later. |
| Size dimensions must all be greater than 0 | Invalid size provided. | Change the size to above 0. |
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| inputs | Dictionary | A dictionary containing the mesh generation prompts. Currently, the only supported key is the Prompt (string) that describes the mesh to generate. | |
| player | Player | The Player requesting the generation. | |
| options | Dictionary | A dictionary for additional generation options to influence the result. The optional SuggestedSize key (Vector3) represents a size guide for the generated asset, meaning GenerationService will attempt to create a model with a size and proportion similar to the provided Vector3, although there is no guarantee on the final output size. | |
| intermediateResultCallback | Function? | A callback function triggered with intermediate generation results. Useful for retrieving early mesh versions before textures are applied. |
Returns
| Type | Description |
|---|---|
| Tuple | A tuple of the generation ID (a unique ID returned for each invocation of GenerateMeshAsync()) and context ID (not currently used). |
| Field | Value |
|---|---|
| tags | ["Yields"] |
| security | None |
| thread safety | Unsafe |
| capabilities | ["DynamicGeneration"] |
Code samples: View on Creator Hub (GenerationService-ClientSideMeshGeneration, GenerationService-ServerSideMeshGeneration, GenerationService-ClientSideMeshGeneration-WithSuggestedSize, GenerationService-ServerSideMeshGeneration-WithSuggestedSize, GenerationService-StarterPlayerScripts-WithSuggestedSize).
GenerationService:GenerateModelAsync
Enables generation of multi-mesh geometries according to provided inputs and a schema.
Provide creative direction through inputs: a TextPrompt, an Image to condition on visually, or both. Control the output structure through schema, supplying either a built-in PredefinedSchema or a custom SchemaDefinition that names the parts to produce.
This method throws an error during the generation process for issues like prompt rejection, generation timeouts, schema mismatches, or backend service errors. It's recommended to wrap it in a LuaGlobals.pcall() to catch such errors.
See this guide for more detailed examples including usage of a Behaviors module to connect functional behaviors to generated models.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| inputs | Dictionary | A table representing conditioning inputs with the following keys: - TextPrompt — String description of the object to generate. Required unless an Image is provided; you must supply at least one of TextPrompt or Image. - Image — Optional Content referencing an image asset (for example, the result of Content.fromAssetId()) used to visually condition the generation. Supply it together with or instead of TextPrompt. - Size — Optional Vector3 describing the object size to generate. This is only approximate; scale the model extents post‑generation if you need a specific size. - MaxTriangles — Optional integer describing the maximum number of triangles that the returned model will contain. Lower values result in more faceted and low-poly generations. - GenerateTextures — true (default) textures the resulting generation, while false will not generate textures. | |
| schema | Dictionary | Table representing the generation schema. Provide exactly one of the following keys: - PredefinedSchema — String selecting a built-in schema. Current valid options are Car5 for a basic vehicle chassis consisting of five Models, or Body1 which results in a single mesh output. - SchemaDefinition — Table describing a custom multi-part structure. It contains a Groups array of part-name strings (one entry per desired part); the returned Model is organized to match the named groups. Use this instead of PredefinedSchema when you need a structure the predefined schemas don't cover. | |
| options | Dictionary? | Currently not used; reserved for future customization options. |
Returns
| Type | Description |
|---|---|
| Tuple | Tuple with the following elements: - A standard Model container instance that is compliant with the specified schema. - A table containing a UUID and other metadata about the generation. |
| Field | Value |
|---|---|
| tags | ["Yields"] |
| security | None |
| thread safety | Unsafe |
| capabilities | ["DynamicGeneration"] |
Code samples: View on Creator Hub (GenerationService-Basic-Car5, GenerationService-Custom-Schema, GenerationService-Image-Conditioning).
GenerationService:LoadGeneratedMeshAsync
Retrieves and loads a mesh generated by GenerateMeshAsync() using the provided generationId. Must be called from client scripts.
The mesh can be returned as a MeshPart or Model. Because editable meshes are not replicated, the loaded mesh is not replicated to any other clients and can only be loaded once per generationId.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| generationId | string | The unique ID returned by GenerateMeshAsync(). Identifies the mesh to load. |
Returns
| Type | Description |
|---|---|
| MeshPart | The generated asset, returned as a Model with a single MeshPart containing an EditableMesh. |
| Field | Value |
|---|---|
| tags | ["Yields"] |
| security | None |
| thread safety | Unsafe |
| capabilities | ["DynamicGeneration"] |
GenerationService:SegmentMeshAsync
Segments an existing MeshPart into multiple named parts according to a provided schema and returns a Model with the segmented parts organized by the schema groups.
The schema parameter accepts the same structure as GenerateModelAsync(): either a PredefinedSchema string (such as "Car5" for a five-part vehicle chassis or "Body1" for a single-mesh output) or a SchemaDefinition table with a Groups array of custom part names.
This method can only be called from Roblox Studio (edit mode or plugin context). For published mesh assets, the caller must have edit permission for the asset. Wrap calls in LuaGlobals.pcall() to handle errors such as permission failures or mesh export issues.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| meshPart | MeshPart | The MeshPart to segment. Must contain mesh geometry (either an EditableMesh or a published mesh asset the caller has edit permission for). | |
| schema | Dictionary | A table specifying how to segment the mesh. Provide exactly one of PredefinedSchema (a string such as "Car5" or "Body1") or SchemaDefinition (a table with a Groups array of part-name strings defining the segmentation structure). | |
| options | Dictionary? | Has no effect. |
Returns
| Type | Description |
|---|---|
| Tuple | A tuple containing a Model whose children are organized according to the specified schema (each group as a child Model with a MeshPart inside), and a table with a UUID key holding the backend job identifier. |
| Field | Value |
|---|---|
| tags | ["Yields"] |
| security | None |
| thread safety | Unsafe |
| 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 |
Events
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. |