local model = script.Parent
local CFrameRotationn = -90
function newCFrame()
local newCFrame= model.PrimaryPart.CFrame * CFrame.Angles(0, math.rad(CFrameRotationn), 0)
model:SetPrimaryPartCFrame(newCFrame)
end
But when the model rotates it will not use the position where I put the PrimaryPart pivot but the default position of the pivot.
When you get a BasePart’s CFrame using .CFrame, it will ignore any changes you’ve made to the BasePart’s PivotOffset. This is because you’ll need to use the :GetPivot() method that BaseParts and Models have to get its CFrame with the pivot offset applied:
local model = script.Parent
local CFrameRotationn = -90
function newCFrame()
local newCFrame= model.PrimaryPart:GetPivot() * CFrame.Angles(0, math.rad(CFrameRotationn), 0)
model:PivotTo(newCFrame)
end
What @ArpeaxVinheim said is correct too, you should use :PivotTo() to move a model. :SetPrimaryPartCFrame() has been deprecated, so it’s no longer recommended to use in new games
local model = script.Parent
local CFrameRotationn = -90
function newCFrame()
local newCFrame= model:PivotTo:(CFrame.Angles(0, math.rad(CFrameRotationn), 0)
model:SetPrimaryPartCFrame(newCFrame)
end
I’m not a hundred percent sure this will work, but I’m pretty confident in it.