Essentially, I have a part that represents where your camera should be looking when aimed down. But because this “aim part” isn’t the base part of the viewmodel, it wouldn’t drag everything else (like the arms & gun) with it. If I were to move it, it would only move by itself. So, I need a method to move this aim part to the camera, but by offseting the main viewmodel part, so that everything else follows it.
I’d get the CFrame offset between the base/camera and the aim part. Then, I’d multiply the base’s CFrame by the offset.
local AimOffset = Base.CFrame * AimPart.CFrame:Inverse()
-- or
local AimOffset = Camera.CFrame * AimPart.CFrame:Inverse()
Keep in mind that you’d have to also update the base for each step to keep the aim consistent. Also, this is just some simple code to get the aim part in position with the base’s (or camera’s) CFrame. I’d advise using TweenService or lerping the CFrame to get a smooth transition for aiming.
It would help to see further code where you position the base relative to the camera. If you’re doing something like
base.CFrame = Camera.CFrame * AimPartOffset
then you have the flaw that each time this occurs the offset is changing because the first time, the base part will be pushed back so that there no longer is an offset between the aim part and camera, however the next time this occurs the calculated offset will be something like the identity cframe, so then the base part will be set back to the cameras position, repeating the loop. I’m not sure how this would result in the gun model being 1500 studs away but I think providing that area of your code will help.
Try calculating the aim offset by doing the other suggestuon suggested by DesiredFlamingFire, and see if that works.
local AimPartOffset = Base.CFrame * ViewmodelAimPart.CFrame:Inverse()