Rotating a Part Towards Another Part

Rotating a Part Towards Another Part

Mar 30 2021, 5:21 AM PST


You want to rotate a part toward another part.


Use the second CFrame argument to rotate in that direction.

local part = Instance.new('Part')
part.Parent = Workspace
part.Anchored = true
part.CFrame = CFrame.new(Vector3.new(0, 0, 0), Workspace.pointAtPart.Position)


We’re basically setting part.CFrame to a new CFrame which is at the position of (0, 0, 0), and is rotated at the part pointAtPart. We use pointAtPart.Position because we want to point at a Vector3 value which is returned by the Position property or CFrame.p.

  • cframe
  • vector3
  • movement
  • animation