How do i get the offset between 2 cframe's and apply them to :setprimarypartcframe()

I want to change the primarypart of a model, but if i do that it will mess up the already saved blocks and would make me have to re-do the offset and other stats.

Is there a way i can get and apply the offset between a cframe from created from an attachment and a cframe to :Setprimarypartcframe so that i can keep using the old primarypart its position, rotation and offset on the new primarypart?

1 Like

If by offset you mean difference in positions of 2 parts then yea, that should be possible. Sadly, you can’t just do CFrameA - CFrameB due to the nature of them, however you can find A relative to B by getting the product of the inverse of B and A, so A.CFrame * B.CFrame:Inverse(). This will give you the offset.

1 Like

image
The CFrame the part needs to be is different when the primarypart is changed of the model,
It needs to be like the brown parts but when the primarypart is changed, it will look like the blue parts.


What i need is something that will make the blue parts look identical to the brown parts, position wise and rotation wise.

Dark blue and dark brown are the primary parts of the 2 models.

primarypart difference.rbxl (36.7 KB)

Sorry for the confusion, i dont really know a great way i could explain this without pictures.

1 Like