Rotate a Part Using Degrees

Rotate a Part Using Degrees

Mar 30 2021, 5:24 AM PST


You want to rotate a part in degrees.


Use the DataType/CFrame|CFrame.Angles function and multiply it by the CFrame position using the math.rad function to convert degrees to radians.

local part = Instance.new('Part')
part.Parent = Workspace
part.Anchored = true
part.CFrame = part.CFrame * CFrame.Angles(0, math.rad(5), 0)


We set part.CFrame to the same position part.CFrame and multiply it by CFrame.Angles but with math.rad(5) as the Y-axis rotation. The math.rad function converts degrees to radians. So in this case we are converting 5 degrees to radians and passing it to CFrame.Angles.

Other times you may see DataType/CFrame|CFrame.fromEulerAnglesXYZ. The function we’ve been using CFrame.Angles is just a shortcut function for CFrame.fromEulerAnglesXYZ. You shouldn’t use the old name (it’s much too long), but if you see it in code you will no longer be confused.

  • math
  • coding