11 min read

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

NameType / ReturnsDescription
GenerationService:GenerateMeshAsyncTupleStarts the generation of a new 3D mesh from a text prompt and returns unique IDs used to track and retrieve the result.
GenerationService:GenerateModelAsyncTupleEnables generation of multi-mesh geometries according to provided inputs and a schema.
GenerationService:LoadGeneratedMeshAsyncMeshPartRetrieves and loads a mesh generated by GenerationService:GenerateMeshAsync() using the provided generationId.
GenerationService:SegmentMeshAsyncTupleSegments an existing MeshPart into multiple named parts according to a provided schema, returning a Model organized by the schema groups.

Inherited from Instance

NameType / ReturnsDescription
Instance:AddTag()Applies a tag to the instance.
Instance:childrenInstancesReturns an array of the object's children.
Instance:ClearAllChildren()This method destroys all of an instance's children.
Instance:CloneInstanceCreate a copy of an instance and all its descendants, ignoring instances that are not Archivable.
Instance:cloneInstance
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:FindFirstAncestorInstance?Returns the first ancestor of the Instance whose Instance.Name is equal to the given name.
Instance:FindFirstAncestorOfClassInstance?Returns the first ancestor of the Instance whose Object.ClassName is equal to the given className.
Instance:FindFirstAncestorWhichIsAInstance?Returns the first ancestor of the Instance for whom Object:IsA() returns true for the given className.
Instance:FindFirstChildInstance?Returns the first child of the Instance found with the given name.
Instance:findFirstChildInstance
Instance:FindFirstChildOfClassInstance?Returns the first child of the Instance whose ClassName is equal to the given class name.
Instance:FindFirstChildWhichIsAInstance?Returns the first child of the Instance for whom Object:IsA() returns true for the given className.
Instance:FindFirstDescendantInstance?Returns the first descendant found with the given Instance.Name.
Instance:GetActorActor?Returns the Actor associated with the Instance, if any.
Instance:GetAttributeVariantReturns the value which has been assigned to the given attribute name.
Instance:GetAttributeChangedSignalRBXScriptSignalReturns an event that fires when the given attribute changes.
Instance:GetAttributesDictionaryReturns a dictionary of the instance's attributes.
Instance:GetChildrenInstancesReturns an array containing all of the instance's children.
Instance:getChildrenInstances
Instance:GetDebugIdstringReturns a coded string of the debug ID used internally by Roblox.
Instance:GetDescendantsInstancesReturns an array containing all of the descendants of the instance.
Instance:GetFullNamestringReturns a string describing the instance's ancestry.
Instance:GetStyledVariantReturns the styled or explicitly modified value of the specified property, or else the default property value if it hasn't been styled/modified.
Instance:GetStyledPropertyChangedSignalRBXScriptSignalReturns an event that fires when the given style property changes on the instance.
Instance:GetTagsArrayGets an array of all tags applied to the instance.
Instance:HasTagbooleanCheck whether the instance has a given tag.
Instance:IsAncestorOfbooleanReturns true if an Instance is an ancestor of the given descendant.
Instance:IsDescendantOfbooleanReturns true if an Instance is a descendant of the given ancestor.
Instance:isDescendantOfboolean
Instance:IsPropertyModifiedbooleanReturns true if the value stored in the specified property is not equal to the code-instantiated default.
Instance:QueryDescendantsInstancesReturns 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:WaitForChildInstanceReturns 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

NameType / ReturnsDescription
Object:GetPropertyChangedSignalRBXScriptSignalGet an event that fires when a given property of the object changes.
Object:IsAbooleanReturns true if an object's class matches or inherits from a given class.
Object:isAboolean

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

ErrorDescriptionRecommended action
Rate limit exceededThe maximum number of mesh generations has been exceeded for the minute.Wait until the rate limit resets.
Moderation failedThe mesh generation was flagged for moderation.Review and modify the prompt to ensure it adheres to Roblox's moderation guidelines.
Internal server errorAn unexpected issue occurred on the server.Retry the request later or check server status for issues.
Character limit exceededThe input prompt length for this generation request exceeded the limit.Reduce the number of characters in the Prompt string of the input dictionary.
Service overloadedThe service is overloaded.Retry the request later.
Size dimensions must all be greater than 0Invalid size provided.Change the size to above 0.

Parameters

NameTypeDefaultDescription
inputsDictionaryA dictionary containing the mesh generation prompts. Currently, the only supported key is the Prompt (string) that describes the mesh to generate.
playerPlayerThe Player requesting the generation.
optionsDictionaryA 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.
intermediateResultCallbackFunction?A callback function triggered with intermediate generation results. Useful for retrieving early mesh versions before textures are applied.

Returns

TypeDescription
TupleA tuple of the generation ID (a unique ID returned for each invocation of GenerateMeshAsync()) and context ID (not currently used).
FieldValue
tags["Yields"]
securityNone
thread safetyUnsafe
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

NameTypeDefaultDescription
inputsDictionaryA 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.
schemaDictionaryTable 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.
optionsDictionary?Currently not used; reserved for future customization options.

Returns

TypeDescription
TupleTuple 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.
FieldValue
tags["Yields"]
securityNone
thread safetyUnsafe
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

NameTypeDefaultDescription
generationIdstringThe unique ID returned by GenerateMeshAsync(). Identifies the mesh to load.

Returns

TypeDescription
MeshPartThe generated asset, returned as a Model with a single MeshPart containing an EditableMesh.
FieldValue
tags["Yields"]
securityNone
thread safetyUnsafe
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

NameTypeDefaultDescription
meshPartMeshPartThe MeshPart to segment. Must contain mesh geometry (either an EditableMesh or a published mesh asset the caller has edit permission for).
schemaDictionaryA 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).
optionsDictionary?Has no effect.

Returns

TypeDescription
TupleA 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.
FieldValue
tags["Yields"]
securityNone
thread safetyUnsafe
capabilities["DynamicGeneration"]

Properties

Inherited from Instance

NameType / ReturnsDescription
Instance.ArchivablebooleanDetermines if an Instance and its descendants can be cloned using Instance:Clone(), and can be saved/published.
Instance.archivableboolean
Instance.CapabilitiesSecurityCapabilitiesThe set of capabilities allowed to be used for scripts inside this container.
Instance.IsInSandboxbooleanIndicates whether the instance is inside a sandboxed container.
Instance.NamestringA non-unique identifier of the Instance.
Instance.ParentInstanceDetermines the hierarchical parent of the Instance.
Instance.PredictionModePredictionModeReflects the client-side prediction mode applied to the instance under server-authoritative physics.
Instance.RobloxLockedbooleanA deprecated property that used to protect CoreGui objects.
Instance.SandboxedbooleanWhen enabled, the instance can only access abilities in its Capabilities list.
Instance.UniqueIdUniqueIdA unique identifier for the instance.

Inherited from Object

NameType / ReturnsDescription
Object.ClassNamestringA read-only string representing the class this Object belongs to.
Object.classNamestring

Events

Inherited from Instance

NameType / ReturnsDescription
Instance.AncestryChangedFires when the Instance.Parent property of this object or one of its ancestors is changed.
Instance.AttributeChangedFires whenever an attribute is changed on the Instance.
Instance.ChildAddedFires after an object is parented to this Instance.
Instance.childAdded
Instance.ChildRemovedFires after a child is removed from this Instance.
Instance.DescendantAddedFires after a descendant is added to the Instance.
Instance.DescendantRemovingFires immediately before a descendant of the Instance is removed.
Instance.DestroyingFires immediately before (or is deferred until after) the instance is destroyed via Instance:Destroy().
Instance.StyledPropertiesChangedFires whenever any style property is changed on the instance, including when a property is set to nil.

Inherited from Object

NameType / ReturnsDescription
Object.ChangedFires immediately after a property of the object changes, with some limitations.