PcoWSkbVqDnWTu_dm2ix
Collapse Sidebar

GetPrimaryPartCFrame

Returns the CFrame of the Model's Model/PrimaryPart.

This function is equivalent to the following.

Model.PrimaryPart.CFrame

Note this function will throw an error if no primary part exists for the Model. If this behavior is not desired developers can do the following, which will be equal to nil if there is no primary part.

local cFrame = Model.PrimaryPart and Model.PrimaryPart.CFrame

Returns

Return Type Summary

Code Samples


Rotating a Model

The following code demonstrates how GetPrimaryPartCFrame and SetPrimaryPartCFrame can be used to rotate a model.

A simple model is created in the Workspace and a loop is started that will rotate the model 10 degrees around the Y axis every 0.2 seconds.