PcoWSkbVqDnWTu_dm2ix
The Developer Hub is now deprecated and information on this page may no longer be accurate. To see our new and improved documentation, please click here. You can read more about the future of documentation here.
Collapse Sidebar

PrimaryPart

Model

BasePart

Points to the primary part of the Model. The primary part is the BasePart that acts as the physical reference for the pivot of the model. That is, when parts within the model are moved due to physical simulation or other means, the pivot will move in sync with the primary part. If the primary part is not set, the pivot will remain at the same location in world space even if parts within the model are moved.

Note that when setting this property, it must be a BasePart that is a descendant of the model. If you try to set Model/PrimaryPart to a BasePart that is not a descendant of the model, it will be set to that part but reset to nil during the next simulation step — this is legacy behavior to support scripts which assume they can temporarily set the primary part to a BasePart which isn’t a descendant of the model.

The general rule for models is that:

  • Models whose parts are joined together via physical joints such as WeldConstraint|WeldConstraints or Motor6D|Motor6Ds should have a primary part assigned. For example, Roblox character models have their Model/PrimaryPart set to the HumanoidRootPart by default.
  • Static (usually BasePart/Anchored|Anchored) models which stay in one place unless a script explicitly moves them don’t require a Model/PrimaryPart and tend not to benefit from having one set.


Code Samples


Throwing Dice

This code sample creates and throws a dice model, then outputs whether it landed with the blue side facing up. If Model/PrimaryPart was not set, the pivot / bounding box of the dice would rotate, as the parts inside of it are physically simulated during the roll.