Class
GenerationService
NotCreatableService
Service that allows developers to generate 3D objects from text prompts.
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.
Methods 4#
| GenerateMeshAsync | Starts the generation of a new 3D mesh from a text prompt and returns unique IDs used to track and retrieve the result.DeprecatedYields |
| GenerateModelAsync | Enables generation of multi-mesh geometries according to provided inputs
and a schema.Yields |
| LoadGeneratedMeshAsync | Retrieves and loads a mesh generated by
GenerationService:GenerateMeshAsync() using the provided
generationId.Yields |
| SegmentMeshAsync | Segments an existing MeshPart into multiple named parts according
to a provided schema, returning a Model organized by the schema
groups.Yields |
GenerateMeshAsync(inputs: Dictionary, player: Player, options: Dictionary, intermediateResultCallback: Function?): Tuple#
YieldsDeprecated
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. |
| 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
Tuple— A tuple of the generation ID (a unique ID returned for each invocation ofGenerateMeshAsync()) and context ID (not currently used).
GenerateModelAsync(inputs: Dictionary, schema: Dictionary, options: Dictionary?): Tuple#
Yields
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.
| Name | Type | Default | Description |
|---|---|---|---|
inputs | Dictionary | A table representing conditioning inputs with the following keys:
| |
schema | Dictionary | Table representing the generation schema. Provide exactly one of the following keys:
| |
options | Dictionary? | Currently not used; reserved for future customization options. |
Returns
Tuple—Tuple with the following elements:
- A standard
Modelcontainer instance that is compliant with the specifiedschema. - A table containing a UUID and other metadata about the generation.
- A standard
LoadGeneratedMeshAsync(generationId: string): MeshPart#
Yields
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.
| Name | Type | Default | Description |
|---|---|---|---|
generationId | string | The unique ID returned by
GenerateMeshAsync().
Identifies the mesh to load. |
Returns
MeshPart— The generated asset, returned as aModelwith a singleMeshPartcontaining anEditableMesh.
SegmentMeshAsync(meshPart: MeshPart, schema: Dictionary, options: Dictionary?): Tuple#
Yields
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.
| 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. |
Inherited members#
Inherited from Instance 58
Properties (10)
Archivable, archivable, Capabilities, IsInSandbox, Name, Parent, PredictionMode, RobloxLocked, Sandboxed, UniqueId
Methods (39)
AddTag, children, ClearAllChildren, Clone, clone, Destroy, destroy, FindFirstAncestor, FindFirstAncestorOfClass, FindFirstAncestorWhichIsA, FindFirstChild, findFirstChild, FindFirstChildOfClass, FindFirstChildWhichIsA, FindFirstDescendant, GetActor, GetAttribute, GetAttributeChangedSignal, GetAttributes, GetChildren, getChildren, GetDebugId, GetDescendants, GetFullName, GetStyled, GetStyledPropertyChangedSignal, GetTags, HasTag, IsAncestorOf, IsDescendantOf, isDescendantOf, IsPropertyModified, QueryDescendants, Remove, remove, RemoveTag, ResetPropertyToDefault, SetAttribute, WaitForChild