This item is not replicated across Roblox’s server/client boundary.
This property determines where the pivot of a
Model which does not have a set
Model/PrimaryPart is located. If the
Model does have a
Model/PrimaryPart|PrimaryPart, the pivot of the
Model is equal to the pivot of that primary part instead, and this
Model/WorldPivot|WorldPivot property is ignored.
For a newly created
Model, its pivot will be treated as the center of the bounding box of its contents until the first time its
Model/WorldPivot property is set. Once the world pivot is set for the first time, it is impossible to restore this initial behavior.
Most commonly, moving the model with the Studio tools, or with a model movement function such as
Model/SetPrimaryPartCFrame will set the world pivot and thus end this new model behavior.
The purpose of this behavior is to allow Lua code to get a sensible pivot simply by creating a new model and parenting objects to it, avoiding the need to explicitly set
Model/WorldPivot every time you create a model in code.
local model = Instance.new("Model") workspace.BluePart.Parent = model workspace.RedPart.Parent = model model.Parent = workspace print(model:GetPivot()) -- Currently equal to the center of the bounding box containing "BluePart" and "RedPart" model:PivotTo(CFrame.new(0, 10, 0) -- This works without needing to explicitly set "model.WorldPivot"
This code sample shows a custom function for resetting the pivot of a model back to the center of that model’s bounding box.
local function resetPivot(model) local boundsCFrame = model:GetBoundingBox() if model.PrimaryPart then model.PrimaryPart.PivotOffset = model.PrimaryPart.CFrame:ToObjectSpace(boundsCFrame) else model.WorldPivot = boundsCFrame end end