I need this model to stand up the correct way

I have a sort of problem with moving a part. Basically, I’m moving this model to the tray, but it’s facing the wrong way. I’ve been trying many things, and I’ve found that Origin Orientation is not available to be edited in a script. I’ve tried CFrame.Angles, but it doesn’t seem to be working.

Here’s the part of the script that’s moving the model to the specific spot:

pastryClone:SetPrimaryPartCFrame(CFrame.new(Vector3.new(tray.Position.X,tray.Position.Y+1,tray.Position.Z)))

Here’s an image of the result:
image

I’ve tried things like:

pastryClone:SetPrimaryPartCFrame(CFrame.new(Vector3.new(tray.Position.X,tray.Position.Y+1,tray.Position.Z),CFrame.Angles(0,-90,0)))

But they just cause the script to not work, aka the rest of the script isn’t run, and it seems to be stuck at that part because of an unstated error.

1 Like

Try multiplying CFrame.Angles?

pastryClone:SetPrimaryPartCFrame(CFrame.new(Vector3.new(tray.Position.X,tray.Position.Y+1,tray.Position.Z)) * CFrame.Angles(0,-90,0))

The error would be handy to see as well

Thanks, that worked.

I meant here that there were no shown errors

CFrame.Angles requires a value in radians. Also multiplying as @Jackscarlett said, so just wrap your desired angle in math.rad()

CFrame.Angles(0,math.rad(-90),0)

Also little FYI for organizational purposes, you don’t have to pass a Vector3 to CFrame.new, just the first 3 values work.

CFrame.new(1,2,3)
-- is the same as
CFrame.new(Vector3.new(1,2,3))

Origin Orientation is a relative property of Model.WorldPivot, this property value is a CFrame. If the part is facing the wrong way; you can try things depending on your scenerio.

To create a CFrame that faces a specific direction, you can use CFrame.new(Vector3 Origin, Vector3 LookAt) and it should return a CFrame value that corresponds with this expectation.