I can change the CFrame of a brick by using
part.CFrame = CFrame.new(blah,blah,blah)
But the rotation of the brick gets messed up. I can always do
part.CFrame = CFrame.new(blah,blah,blah) * CFrame.Angles(blah,blah,blah)
But what if I only want to change the rotation of one axis and keep the rest the same? The brick's rotation constantly changes so don't suggest "put the same angle in the other two axis and change the third one".
Use CFrame:toEulerAnglesXYZ(). Example:
local part = game.Workspace.Part local x,y,z = part.CFrame:toEulerAnglesXYZ() part.CFrame = CFrame.new(0,10,0) * CFrame.Angles(x,math.rad(45),z)
But you probably could have found that out if you researched the wiki toroughly enough..
EDIT: Though this answer is correct, BlueTaslem's answer is likely to be less expensive.
Subtract the position from the CFrame, and then add the new position.
This involves no special extra work; it's much simpler and more elegant to do -- you should only rarely have to invoke :toEulerAngles
local orientation = part.CFrame - part.Position; part.CFrame = orientation + Vector3.new( blah, blah, blah );