Is there a way to construct a CFrame based off the position and orientation of two pre-existing parts?

Hello, I know this is an odd question to ask, but is there some way a CFrame can be generated based off the position and orientation of two different already-existing parts in workspace?

Based on what I can find, the “Position” of a CFrame is set to read-only, so I can’t just take the CFrame of the first part and change the position/orientation to the second part. This is further complicated by the fact there is no CFrame.new() constructor that takes Position and Orientation Vector3s; the closest there is would be CFrame.new(origin,lookAt).

CFrame.LookAt mentioned above isn’t my goal, otherwise I wouldn’t have made this thread. I don’t want a CFrame from an origin point (first part’s position) oriented to “look at” another point (second point’s position), I want to generate a CFrame using the first part’s position and the second part’s orientation.

I know my wording may be slightly confusing, but I’m trying my best to be direct and straightforward so others can understand the issue I’m having and (hopefully) come up with a way to solve it.

I’ll be awaiting responses, and thanks for any help you can provide.
–Catz

simple math, CFrame + Vector3

local cf = partB.CFrame.Rotation + partA.CFrame.Position

partB is the rotation, partA is the position

That doesn’t seem to have worked, code threw an error when I attempted to add the two values.
image
I’m trying basically the exact thing you suggested, the only difference being that the parts are named differently.

are you using the correct values? The error is asking for a Vector3, yet .Position IS a Vector3.

Yea, I’m an idiot, accidentally used .Rotation instead of .Position somehow. Testing it again

Yep, everything seems to be working now. Thanks for the assist.