Model
Model : PVInstance
Overview
A Model is a container that groups multiple objects for management, which is mainly used to handle collections of BaseParts.
It is deal for grouping parts that are related in position or structure. If you want to group elements that do not have a physical form, such as scripts, using a Folder is more appropriate.
It supports applying physical effects collectively to the grouped objects, while allowing operations such as moving, rotating, or deleting them. This enables treating multiple objects as a single unit without controlling each one individually.
Properties
PrimaryPart
BasePart
This property designates the BasePart that serves as the reference for the model.
The target designated as the PrimaryPart must be a BasePart that is child of the model. A BasePart that is not a child cannot be assigned.
For a Character Model, the PrimaryPart is the HumanoidRootPart.
Code Samples
local Model = script.Parent
Model.PrimaryPart = Model.PartWorldPivot
CFrame
Defines the pivot point of rotation for a model that does not have a PrimaryPart. If the model has a PrimaryPart, the pivot is replaced by that part's reference point, and this property is ignored.
Code Samples
Methods
BreakJoints
Currently not supported.
Parameters
Return
void
Code Samples
GetPivot
Retrieves the CFrame information of the current Pivot.
Parameters
Return
CFrame
The CFrame of Model Pivot.
Code Samples
MoveTo
Moves all BaseParts within a Model instantly to a specified target position, based on the Modelβs current pivot, regardless of whether the parts are Anchored. If there are obstacles such as other BaseParts at the target position, the Model automatically adjusts upward to avoid overlapping.
Since MoveTo only affects position, the Modelβs rotation remains unchanged even after reaching the target position.
It is recommended to use PivotTo feature when you do not have to consider obstacles at target position or need to apply rotation value.
Parameters
Vector3 InPosition
The coordinates of the target position to move to.
Return
void
Code Samples
PivotTo
Instantly moves internal BaseParts to a specified position based on the current Pivot of Model, regardless of their Anchored state. Unlike MoveTo, it ignores any obstacles at the destination (e.g. BaseParts) and does not perform collision checks, allowing overlapping movement with obstacles.
Moreover, PivotTo takes CFrame as a parameter and applies both position and rotation.
It is recommended to use MoveTo feature when you need to consider the obstacles at target position, or only need to apply position value.
Parameters
CFrame InTargetCFrame
The target CFrame value to be moved.
Return
void
Code Samples
SetPrimaryPartCFrame
A feature used to specify the position and rotation of a PrimaryPart that works as the center of a model.
When the PrimaryPart's CFrame changes, all parts included in the model move accordingly, while maintaining their relative orientation and distance from the PrimaryPart. In other words, it is the core mechanism used to move or rotate the entire model at once.
However, an error occurs if this function is called for a model without PrimaryPart.
Parameters
CFrame InNewCFrame
The CFrame to set.
Return
void
Code Samples
Events
See also
ModelLast updated