i am making a game with a model which has to be rotated a certain direction depending on a certain value, but the problem is all scripts that I found add rotation to the frame, here is my script for you to understand more
if Direction == "East" then Parent:SetPrimaryPartCFrame(Parent.PrimaryPart.CFrame * CFrame.Angles(0, math.rad(90), 0)) end
in summary, I need to set the rotation to 0,90,0, not add 0,90,0
Instead of just adding the 90 degrees as you are in that code you can simply create a new CFrame that uses that position and then add the degrees to that new angle
example:
Parent:SetPrimaryPartCFrame(CFrame.new(Parent.PrimaryPart.CFrame.Position) * CFrame.Angles(0, math.rad(90), 0))
Multiplying CFrames is usually used to offset a part relative to another part. In your case you want to directly change the orientation.
if Direction == "East" then Parent.PrimaryPart.Orientation = Vector3.new(0, 90, 0) end