Arm Rotation Having Offset

I was checking out this post and trying to follow its steps. So like I ran into a problem during the server sided humanoid tilting part.

The intended situation is that the arms move along together with the weapon, but the problem is that since the weapon hold animation’s left arm has an orientation in the x-axis it makes the up and down movement of the arms not sync when moving up and down: Check this place for reference. It is optimized so that the player uses its own camera for orientation offset so dont worry about that part

My code is here (adapted from GuestCapone’s thing I found from library)

local i = 0
		local NeckC0
		local NeckC1
		game.ReplicatedStorage.Events.tiltChar.OnServerEvent:Connect(function(plr,cf)
			local char = plr.Character
			local CF = cf --cf is the local camera's CFrame
			
			local torso = char:WaitForChild("Torso")
			local Neck = torso:WaitForChild("Neck")
			local LeftShoulder = torso:WaitForChild("Left Shoulder")
			local RightShoulder = torso:WaitForChild("Right Shoulder")
			local Weapon = torso:WaitForChild("ToolGrip")
			local Humanoid = char:WaitForChild("Humanoid")

			local RC1 = CFrame.new(-.5, .5, 0, 0, 0, 3, 0, 3, 0, -1, 0, 0)
			local LC1 = CFrame.new(.5, .5, 0, 0, 0, -3, 0, 3, 0, 1, 0, 0)
			
			if i == 0 then
				NeckC0 = Neck.C0
				NeckC1 = Neck.C1
				i = 1
			end
			
			local offset = CFrame.Angles(0,0,cf.lookVector.Y)
			local tool = char:FindFirstChildOfClass("Tool")
			
			if tool then
				RightShoulder.C1 = RC1 * offset:inverse()
				LeftShoulder.C1 = LC1 * offset
				Weapon.C1 = CFrame.new(CF.lookVector.Y,0,0):inverse()
			end	
			Neck.C0 = NeckC0 * CFrame.Angles(math.asin(CF.lookVector.Y), 0, 0):inverse()
		end)
2 Likes

Lol, all I had to do is change the c0 instead of c1 :rofl:

2 Likes