GenerationService
Service that allows developers to generate 3D objects from text prompts.
Memory category | Instances |
---|
Member index 5
Description
GenerationService
allows developers to generate 3D objects from text
prompts. Mesh generation is a two step process:
- GenerateMeshAsync() starts the mesh generation process using a text prompt and other required parameters. It returns a unique identifier (generation ID) that can be used to retrieve the future result.
- LoadGeneratedMeshAsync() loads the generated mesh into the experience. The mesh is returned as a MeshPart or Model.
Currently, GenerationService
only supports the following usage:
- GenerateMeshAsync() must be called from server scripts.
- LoadGeneratedMeshAsync() must be called from client scripts.
As a result, when a mesh generation request originates from a client, the client must send a signal to the server to initiate generation. Once the server determines that generation is complete, it should notify the appropriate client to call LoadGeneratedMeshAsync() and retrieve the mesh. Note that since the generated mesh is loaded with EditableMesh content and only on the client, it is not replicated to any other clients.
The following code samples illustrate this design pattern. See this demo experience for a more detailed example (click the ⋯ button and Edit in Studio).
History 6
- 662 Add InternalGenerateMeshAsync
- 661 Add
- 661 Add
- 661 Add LoadGeneratedMeshAsync
- 661 Add GenerateMeshAsync
- 661 Add GenerationService
Members 5
GenerateMeshAsync
Parameters (4) | ||
---|---|---|
inputs | Dictionary | |
player | Player | |
options | Dictionary | |
intermediateResultCallback | Function? | |
Returns (1) | ||
Tuple |
Starts the generation of a new 3D mesh from a text prompt and returns
unique IDs used to track and retrieve the result. 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 developer 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 be greater than 0 | Invalid size provided. | Change the size to above 0 . |
Thread safety | Unsafe |
---|
History 1
- 661 Add GenerateMeshAsync
InternalGenerateMeshAsync
Parameters (4) | ||
---|---|---|
inputs | Dictionary | |
userId | int64 | |
options | Dictionary | |
intermediateResultCallback | Function? | |
Returns (1) | ||
Tuple |
Security | RobloxScriptSecurity |
---|---|
Thread safety | Unsafe |
History 1
LoadGeneratedMeshAsync
Parameters (1) | ||
---|---|---|
generationId | string | |
Returns (1) | ||
MeshPart |
Retrieves and loads a mesh generated by
GenerateMeshAsync() using
the provided generationId
. 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
.
Thread safety | Unsafe |
---|