What is difference between model:SetPrimaryPartCFrame(cf) vs model.PrimaryPart.CFrame = cf?

The title says it all, I would like to know the difference between model:SetPrimaryPartCFrame and manually writing to CFrame from the primary part. They seem to do the same exact thing, set CFrame of the primary part (if there is one, otherwise exception thrown).

I personally use :SetPrimaryPartCFrame as it exists for a reason. But I’m not sure what is that reason.

They are pretty much the same. SetPrimaryPartCFrame uses the same code as the other technique I believe.

As explained on the dev hub page for this method, and in the above image, it moves the entire model with respect to the PrimaryPart’s orientation and position to the rest of the model.

This means if you have a model that is not attached by any welds or anything, the whole model will still be moved (as opposed to only moving the BasePart).

3 Likes

the first sets the c frame of the primary part(which moves the whole model to a position corresponding to the primary part), and the second detects the cframe of the primary part. It exists because it is a better way to move parts around that are in a model. Instead of scripting each one you just use one and the whole thing moves.

Thx a lot, i now understand how to use cframes and setPrimaryPartCFrame