Viewmodel Torso rotation issues in first person

Hi, I am having an issue with this viewmodel, here’s the problem:

In third person the melee will swing normally, the torso is rotated and the melee is influenced based on animation, but when I go in first person, the arms swing just fine, but the torso is completely ignored, so I have to change the animation to look less detailed (less torso rotation) in order to make it work in first person and third person.

— Here is the block of code that makes the arms move in first person

		if LeftShoulder then LeftShoulder.C0 = LeftShoulder.C0:Lerp((Camera.CFrame * CFrame.new(-1, -1, 0) * cframe):ToObjectSpace(Torso.CFrame):Inverse() * CFrame.Angles(0, -math.pi / 2, 0), 0.35) end		
		if RightShoulder then RightShoulder.C0 = RightShoulder.C0:Lerp((Camera.CFrame * CFrame.new(1, -1, 0) * cframe):ToObjectSpace(Torso.CFrame):Inverse() * CFrame.Angles(0, math.pi / 2, 0), 0.35) end
		end	
		FirstPerson = true

Does anybody know why this is occurring?

I believe you already know your problem which is the torso being ignored.

You can try multiplying the viewmodel torso CFrame with the rootMotor6D.Transform CFrame to have it move as well.

if LeftShoulder then LeftShoulder.C0 = LeftShoulder.C0:Lerp((Camera.CFrame * CFrame.new(-1, -1, -0.5)):ToObjectSpace(Torso.CFrame * Character.HumanoidRootPart.RootJoint.Transform):Inverse() * CFrame.Angles(0, -math.pi / 2, 0), 0.2) end		
		if RightShoulder then RightShoulder.C0 = RightShoulder.C0:Lerp((Camera.CFrame * CFrame.new(1, -1, -0.5)):ToObjectSpace(Torso.CFrame * Character.HumanoidRootPart.RootJoint.Transform):Inverse() * CFrame.Angles(0, math.pi / 2, 0), 0.2) end

Okay, I tried that method and it seems to cause a weird issue with the swinging.

Try swapping the order transform*Torso.CFrame, order matters a lot in Cframe and sometimes it fixes the problem from my experience.

Otherwise you can try solving for the torso CFrame frome the humanod root part using the weld formula where part 0 is the humanoid root part and part 1 is the torso CFrame that is being solved.

----motor.part0*c0*transform = motor.Part1*C1
--Solve for Part1
--motor.part0*c0*transform*C1:Inverse() = motor.Part1

CFrames are weird tbh just keep trying to change it and eventually you can reach the goal.

Still confused on where to put this and what exactly to do, I swapped the cframes and it just made my characters arm fly out the map.

Instead of that complex CFrame stuff, try disabling autorotate. This should disable the torso lock in first person.

You might need a custom script to rotate the torso though, but first try this.