Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

how do I change model's orientation TO and not BY?

this is what I tried but did not work.

model:SetPrimaryPartCFrame(model.MainPart.CFrame * CFrame.Angles(0, -90 ,0))

1 answer

Make a new CFrame that uses the position of the part, and multiply the orientation to it.

local RotatedCFrame = CFrame.new(model.MainPart.Position) * CFrame.Angles(0, math.rad(-90), 0)
model:SetPrimaryPartCFrame(RotatedCFrame)

Hope this helps! :)

7 comments

0

I think you meant CFrame.new(model.MainPart.Position) * CFrame.Angles(0, -90, 0) =P

0

Yep. Fixed. I'm messy today :p

0

did not work for me

0

make sure to use math.rad() inside the CFrame.Angles because it takes radians not degrees

0

never mind. I thought :p was part of the code

0

but the output says "Unable to cast Vector3 to CoordinateFrame"

0

Use the code I provided above, you are probably reading it incorrectly

This discussion is preserved as it was. New answers, comments, and votes are closed.