Motor6d offset not working correctly

I am currently making a gun system, and i was implementing a aim part. its in the correct location in studio, but when i start the game the offset is wrong.

does anyone know how to fix this?


the offsets are identical whether in roblox studio or ingame.

The problem probably have something to do with animation
if the aim part is not being animated
instead of connecting the part with MD6 just use regular weld

How are you computing and applying the aim offset?

If my memory is correct, the way to compute the offset is, rootpartCF * aimpartCF:Inverse()

this is my aim offset: LocalView.PrimaryPart.CFrame = barrelCF * swayOffset * barrelCF:toObjectSpace(cameraCF * AimCF)