Caculate angles weld?

Hi everybody.
Well, I need everyone to show me how to correctly calculate weld as the plugin does. I really don’t know what to do with angles, and coordinates I can do.
image
thanks for help.

Remember the position of the two parts before and after are the same in the world.

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.