for i = 1, 100 do
local a = workspace.Part
local RX, RY, RZ = workspace.Part.CFrame:toOrientation();
local NewCFrame = CFrame.new(workspace.Part.CFrame.p) * CFrame.fromOrientation(0, RY, 0);
a.CFrame = NewCFrame * CFrame.Angles(0, .1, 0);
end
If you’re looking to rotate your brick like that, you will need to put in a math.rad(90) at the z in your * CFrames.Angles(0, .1, 0) part of your code.
for i = 1, 100 do
local a = workspace.Part
local RX, RY, RZ = a.CFrame:toOrientation();
local NewCFrame = CFrame.new(workspace.Part.CFrame.p) * CFrame.fromOrientation(0, RY, 0);
a.CFrame = NewCFrame * CFrame.Angles(0, .1, math.rad(90));
end
Axis aside, as written, this code probably isn’t doing what you intended. There is no form of wait() in this loop, so it’s changing the CFrame of the part 100 times for every 1 time it gets rendered (assuming there is some outer loop). So this whole loop above is just a very expensive way to do one 10-radians rotation. 10 radians is 2 full rotations plus about 1.6 degrees, whereas 0.1 radians is more like 5.7 degrees.
Additionally, if you mean for the part to rotate in place, you should just multiply its CFrame by the rotation CFrame. You’re additionally making the part orbit the origin, by some amount that corresponds to it’s previous local orientation. This is a rather complex behavior and it’s not clear to me if it’s intentional, or if you just haven’t noticed it yet because your part happens to be at 0,0,0.