I was using the :GetModelCFrame() for rotating a entire model with this script. The problem is that this function is deprecated and I'm looking for a new way to get the model CFrame...
function TransformModel(objects, center, new, recurse)
for _,object in pairs(objects) do
if object:IsA("BasePart") then
object.CFrame = new:toWorldSpace(center:toObjectSpace(object.CFrame))
end
if recurse then
TransformModel(object:GetChildren(), center, new, true)
end
end
end
And the lines to call the function:
local center = NewModel:GetModelCFrame()
TransformModel(
NewModel:GetChildren(),
center,
center * CFrame.Angles(0, math.rad(90), 0),
true
)
If there is a better way to rotate a model, tell me! Thanks for the help if somebody can!

2 comments
The problem is that I already set a PrimaryPart, and I need it to move the model with :SetPrimaryPartCFrame(), and I don't want to set the PrimaryPart to another part ... Do you know if there is a function to get the model's center CFrame?
You have to define the center of the model in terms of the primary part.