I’m not quite sure about what you mean, but you would theoretically just want to get the offset between the two CFrames and applying it to the C0 like so:
Note: I’m using a Motor6D because it has less limitations for what you can do with it compared to a ManualWeld.
function CreateWeld(a, b)
local Weld = Instance.new("Motor6D")
Weld.C0 = a.CFrame:inverse() * b.CFrame
Weld.Part0 = a
Weld.Part1 = b
Weld.Parent = a
end
Also, if you’d like to know more about how the theory behind welding works then you can read the post where I explained it here.