Hello, if you are still having problems with the code, I advise you to check collision. My viewmodel has collision group set to “viewModel” and CanCollide false on everything, and this doesn’t happen, I tested your code, and it didn’t make my camera spin.
It’s because of the animation, I made new animations and I am experiencing the same problem. My old animations’ animated camera works fine, but when you try to change them they break, maybe because there’s too much shake? There’s more reasons
The camera has slight animation to it, meaning it isn’t too violent or not noticable. I figured out the reason recently and forgot to close the thread. Thanks anyways!
Because the Cam part was attached to the HRP, and you were adjusting the HRPs position attached to the camera, when the camera would move, so would the cam part, and it would cause a chain effect of moving. A sum of it is: The Cam Part moves, the camera moves with the cam part, the viewmodel also moves with the camera, and the cam part is attached to the viewmodel, which is what causes the broken movement. To fix it have the cam part be the main bone.
I actually figured out a few weeks ago after watching a video of someone making a viewmodel system, it turns out the hierachy wasn’t the issue and it was the code for setting the cameras rotation.
This is the code I used.
local oldCamCF = CFrame.new()
local newCamCF = viewmodel.FakeCamera.CFrame:ToObjectSpace(viewmodel.PrimaryPart.CFrame)
camera.CFrame *= newCamCF:ToObjectSpace(oldCamCF)
oldCamCF = newCamCF