15 min read

Source: Roblox Creator Hub · CC BY 4.0 · View source · Code samples: MIT Imported 2026-10-03. Formatting adapted for this site.

GeometryService

Inherits from: Instance → Object

Service containing geometric operations not directly related to specific objects.

Inherits from: Instance

Memory category: Instances

Tags: NotCreatable, Service

Methods

NameType / ReturnsDescription
GeometryService:CalculateConstraintsToPreserveArrayReturns a table of Constraints and Attachments which you may choose to preserve, along with their respective parents.
GeometryService:FragmentAsyncArrayBreaks a BasePart into multiple MeshPart instances, according to the pattern of points passed in, by using voronoi decomposition.
GeometryService:GenerateFragmentSitesArrayProvides an array of positions which can easily be passed into FragmentAsync to perform simple types of destruction.
GeometryService:IntersectAsyncArrayCreates one or more PartOperations or MeshParts from the intersecting geometry of multiple parts.
GeometryService:SubtractAsyncArrayCreates one or more PartOperations or MeshParts from one part minus the space occupied by other parts.
GeometryService:SweepPartAsyncMeshPartCreates a MeshPart which has the shape of the input part stretched/dragged through the given set of CFrame positions.
GeometryService:UnionAsyncArrayCreates one or more PartOperations or MeshParts from one part plus the space occupied by other parts.

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

GeometryService:CalculateConstraintsToPreserve

Returns a table of Constraints and Attachments which you may choose to preserve, along with their respective parents. Iterating over this table lets you decide whether to reparent recommended constraints and attachments to their respective parents.

For more information and detailed examples, see https://create.roblox.com/docs/parts/solid-modeling#in-experience-solid-modeling.

Parameters

NameTypeDefaultDescription
sourceInstanceAn original object that the solid modeling operation was performed on, for example part in UnionAsync().
destinationArrayArray of resulting BaseParts from the solid modeling operation, for example the results of UnionAsync().
optionsDictionarynilOptions dictionary for the method: - tolerance — The distance tolerance, in regards to Attachment preservation, between the attachment and the closest point on the original part's surface versus the closest point on the resulting part's surface. If the resulting distance following the solid modeling operation is greater than this value, the Parent of attachments and their associated constraints will be nil in the returned recommendation table. - weldConstraintPreserve — A WeldConstraintPreserve enum value describing how WeldConstraints are preserved in the resulting recommendation table. - dropAttachmentsWithoutConstraints — Boolean with default of true. If set to false, Attachments that have no Constraints will be preserved.

Returns

TypeDescription
ArrayTable containing information for general case Constraints, NoCollisionConstraints, and WeldConstraints. In cases where an Attachment or Constraint should be dropped, its respective parent will be nil. For general case Constraints such as HingeConstraint:
Key Type
Attachment Class.Attachment
Constraint Class.Constraint or nil
AttachmentParent Class.BasePart or nil
ConstraintParent Class.BasePart or nil
For WeldConstraints:
Key Type
WeldConstraint Class.WeldConstraint
WeldConstraintParent Class.BasePart or nil
WeldConstraintPart0 Class.BasePart
WeldConstraintPart1 Class.BasePart
For NoCollisionConstraints:
Key Type
NoCollisionConstraint Class.NoCollisionConstraint
NoCollisionConstraintParent Class.BasePart or nil
NoCollisionConstraintPart0 Class.BasePart
NoCollisionConstraintPart1 Class.BasePart
FieldValue
securityNone
thread safetyUnsafe
capabilities["CSG"]

Code samples: View on Creator Hub (GeometryService-CalculateConstraintsToPreserve).

GeometryService:FragmentAsync

Breaks a BasePart into multiple MeshPart instances, according to the pattern of points passed in, by using voronoi decomposition. Terrain is not supported. Similar to Clone(), the returned parts have no set Parent.

For more information and detailed examples, see https://create.roblox.com/docs/parts/solid-modeling#in-experience-solid-modeling.

Parameters

NameTypeDefaultDescription
partBasePartA Part, PartOperation, or MeshPart to operate on.
sitesArrayArray of Vector3 defining the site positions. Each site will become a separate part. You can also provide a jagged 2D array of Vector3 by including inner arrays of Vector3 as elements of the outer array. Each inner array will have all of its voronoi cells merged into a single part. GeometryService:GenerateFragmentSites can be used to easily create this input.
optionsDictionarynilOptions table containing all the controls for the method: - CollisionFidelity — The value of CollisionFidelity in the resulting parts, with one caveat: If a 2D array of sites is provided, this collision fidelity will only be applied to parts which came from more than one site. The others will be given Hull precision. - RenderFidelity — The value of RenderFidelity in the resulting parts. - FluidFidelity — The value of FluidFidelity in the resulting parts. - SplitApart — Boolean controlling whether a part should be split into multiple parts if it contains multiple connected components. Default is true (split).

Returns

TypeDescription
ArrayArray of MeshPart along with mapping info. Each array element is a Dictionary with two elements: { “Instance”: instance, “Index”: index }. Index is the index in the outer array of sites; in other words, it tells you which group of sites this instance came from. Note that it is possible for multiple instances to have the same index, if SplitApart is true.
FieldValue
tags["Yields"]
securityNone
thread safetyUnsafe
capabilities["CSG"]

Code samples: View on Creator Hub (GeometryService-FragmentAsync).

GeometryService:GenerateFragmentSites

Provides an array of positions which can easily be passed into FragmentAsync() to perform common types of destruction: Fragmenting an entire BasePart into pieces, or a localized area of a BasePart into pieces.

The positions outputted are partially random, so the output should not be relied on to look exactly the same as the first time it is run with the same parameters.

For more information and detailed examples, see https://create.roblox.com/docs/parts/solid-modeling#in-experience-solid-modeling. Luau code to mimic this API has also been provided on that page, which can be freely modified if a slightly different effect is desired.

Parameters

NameTypeDefaultDescription
partBasePartThe Part, PartOperation, or MeshPart which you are planning to pass into FragmentAsync(). This is necessary to make the fragment site generation and the subsequent FragmentAsync() call efficient.
optionsDictionarynilOptions table containing all the controls for the method: - SiteSpacing — The approximate distance between sites, which directly corresponds to the diameter of the resulting fragments. If not specified, a reasonable value will be chosen. - Origin — If provided, this will be the center of the area to be fragmented. If not provided, the entire object will be fragmented. - Radius — If provided, this will be the center of the area to be fragmented. Either Origin and Radius should both be provided, or neither.

Returns

TypeDescription
ArrayAn array of Vector3 which is typically passed into FragmentAsync(). The output depends on the options provided. If Origin and Radius are provided, then the output array will contain several Vector3 elements which will all be located within the radius, but the first element of the array will be an inner array containing many Vector3 sites which are outside the radius. If Origin and Radius are not provided, the output will simply be an array of Vector3 positions within the extents of the input part.
FieldValue
securityNone
thread safetyUnsafe
capabilities["CSG"]

Code samples: View on Creator Hub (GeometryService-GenerateFragmentSites).

GeometryService:IntersectAsync

Creates one or more PartOperations or MeshParts from the intersecting geometry of multiple parts. Primitive Parts, PartOperations, and MeshParts are supported as inputs, but not Terrain.

Similarly to Clone(), the returned parts have no set Parent. In most cases, you should parent the results to the same place as the main part, then Destroy() the original parts.

This function replaces BasePart:IntersectAsync(). Go to that page for a description of the differences.

For more information and detailed examples, see https://create.roblox.com/docs/parts/solid-modeling#in-experience-solid-modeling.

Parameters

NameTypeDefaultDescription
partInstanceMain Part, PartOperation, or MeshPart to operate on.
partsArrayArray of other parts to intersect with the main part.
optionsDictionarynilOptions table containing all the controls for the method: - CollisionFidelity — The value of CollisionFidelity in the resulting parts. - RenderFidelity — The value of RenderFidelity or RenderFidelity in the resulting parts. - FluidFidelity — The value of FluidFidelity in the resulting parts. - SplitApart — Boolean controlling whether the objects should all be kept together or properly split apart. Default is true (split).

Returns

TypeDescription
ArrayOne or more PartOperations or MeshParts. If the input contained any MeshParts, then the results will always be MeshParts.
FieldValue
tags["Yields"]
securityNone
thread safetyUnsafe
capabilities["CSG"]

Code samples: View on Creator Hub (GeometryService-IntersectAsync).

GeometryService:SubtractAsync

Creates one or more PartOperations or MeshParts consisting of the space occupied by one part minus the space occupied by the other parts. Primitive Parts, PartOperations, and MeshParts are supported as inputs, but not Terrain.

Similarly to Clone(), the returned parts have no set Parent. In most cases, you should parent the results to the same place as the main part, then Destroy() the original parts.

This function replaces BasePart:SubtractAsync(). Go to that page for a description of the differences.

For more information and detailed examples, see https://create.roblox.com/docs/parts/solid-modeling#in-experience-solid-modeling.

Parameters

NameTypeDefaultDescription
partInstanceMain Part, PartOperation, or MeshPart to operate on.
partsArrayArray of parts to subtract from the main part.
optionsDictionarynilOptions table containing all the controls for the method: - CollisionFidelity — The value of CollisionFidelity in the resulting parts. - RenderFidelity — The value of RenderFidelity or RenderFidelity in the resulting parts. - FluidFidelity — The value of FluidFidelity in the resulting parts. - SplitApart — Boolean controlling whether the objects should all be kept together or properly split apart. Default is true (split).

Returns

TypeDescription
ArrayOne or more PartOperations or MeshParts. If the input contained any MeshParts, then the results will always be MeshParts.
FieldValue
tags["Yields"]
securityNone
thread safetyUnsafe
capabilities["CSG"]

Code samples: View on Creator Hub (GeometryService-SubtractAsync).

GeometryService:SweepPartAsync

Creates a MeshPart which has the shape of the input part stretched/dragged through the given set of CFrame positions. The exact shape of the result is defined as the union of the convex hulls of each adjacent pair of CFrames.

If a single CFrame is provided, the result will be a convex hull of the input part.

For more information and detailed examples, see https://create.roblox.com/docs/parts/solid-modeling#in-experience-solid-modeling.

Parameters

NameTypeDefaultDescription
partBasePartA Part, PartOperation, or MeshPart to operate on.
cframesArrayArray of coordinate frames to sweep parts through.
optionsDictionarynilOptions table containing all the controls for the method: - CollisionFidelity — The value of CollisionFidelity in the resulting parts. - RenderFidelity — The value of RenderFidelity in the resulting parts. - FluidFidelity — The value of FluidFidelity in the resulting parts.

Returns

TypeDescription
MeshPartA new MeshPart with the swept geometry.
FieldValue
tags["Yields"]
securityNone
thread safetyUnsafe
capabilities["CSG"]

Code samples: View on Creator Hub (GeometryService-SweepPartAsync).

GeometryService:UnionAsync

Creates one or more PartOperations or MeshParts consisting of the space occupied by one part plus the space occupied by the other parts. Primitive Parts, PartOperations, and MeshParts are supported as inputs, but not Terrain.

Similarly to Clone(), the returned parts have no set Parent. In most cases, you should parent the results to the same place as the main part, then Destroy() the original parts.

This function replaces BasePart:UnionAsync(). Go to that page for a description of the differences.

For more information and detailed examples, see https://create.roblox.com/docs/parts/solid-modeling#in-experience-solid-modeling.

Parameters

NameTypeDefaultDescription
partInstanceMain Part, PartOperation, or MeshPart to operate on.
partsArrayArray of parts to union with the main part.
optionsDictionarynilOptions table containing all the controls for the method: - CollisionFidelity — The value of CollisionFidelity in the resulting parts. - RenderFidelity — The value of RenderFidelity or RenderFidelity in the resulting parts. - FluidFidelity — The value of FluidFidelity in the resulting parts. - SplitApart — Boolean controlling whether the objects should all be kept together or properly split apart. Default is true (split).

Returns

TypeDescription
ArrayOne or more PartOperations or MeshParts. If the input contained any MeshParts, then the results will always be MeshParts.
FieldValue
tags["Yields"]
securityNone
thread safetyUnsafe
capabilities["CSG"]

Code samples: View on Creator Hub (GeometryService-UnionAsync).

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.