How To Change Origin Orientation Of A Model

I am trying to change the orientation of a model. How can I change the Origin Orientation of the model?

function Click()

script.Parent.Parent.[Here] += Vector3.new(0,180,0)

end

script.Parent.ClickDetector.MouseClick:Connect(Click)

[Here] = What I need.

2 Likes

Don’t change the OriginOrientation.
Just change the Orientation.

I think you should change the CFrame instead, they have all the functionality you need and more.

local model = script.Parent.Parent
local currentCF = model:GetPivot()
local newCF = currentCF * CFrame.Angles(0, math.rad(180), 0) -- Rotate by 180 deg around the Y axis
model:PivotTo(newCF)

(This can be done in fewer lines, I split it up to more lines to make it easier to follow)

8 Likes

I was about to type this exact thing as well; I believe this is (currently) the best way to rotate a model.

2 Likes

There is an issue though. The button doesn’t turn it back around when you press it again. The orientation doesn’t switch, it changes once.

Then you’d have to check if it has been rotated (either by storing that in a variable, or by checking it’s values). If it has been rotated, then rotate by 0 instead of 180.

1 Like