How to make Third Person Shooter arm movement with 100% accuracy

I am trying to make a third person shooter game but cant really get perfect arm movement.

as you can see either it goes too high or too low if I am not pointing dead straight.

local Character = script.Parent
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local RunService = game:GetService("RunService")

local HRP = Character:WaitForChild("HumanoidRootPart")
local Head = Character:WaitForChild("Head")
local RightArm = Character:WaitForChild("Right Arm")
local Neck:Motor6D = Character:FindFirstChild("Neck",true)
local RightShoulder:Motor6D = Character:FindFirstChild("Right Shoulder",true)
local LeftShoulder:Motor6D = Character:FindFirstChild("Left Shoulder",true)
local ROff = script:WaitForChild("RightArmOff")
local LOff = script:WaitForChild("LeftArmOff")

local NeckOff = Neck.C1
local RightArmOff = RightShoulder.C1
local LeftArmOff = LeftShoulder.C1

local db = false

RunService.RenderStepped:Connect(function()
	local cx,cy,cz = workspace.CurrentCamera.CFrame:ToOrientation()
	local NeckCF = NeckOff*CFrame.Angles(cx,0,0)
	local RArmCF = RightArmOff*CFrame.Angles(0,0,-cx-math.pi/2)*ROff.Value
	local LArmCF = LeftArmOff*CFrame.Angles(0,0,cx+math.pi/2)*LOff.Value
	Neck.C1 = NeckCF
	RightShoulder.C1 = RArmCF
	LeftShoulder.C1 = LArmCF
	local LV = workspace.CurrentCamera.CFrame.LookVector
	coroutine.resume(coroutine.create(function()
		if not db then
			db = true
			wait(2)
			game.ReplicatedStorage.UpdateArm:FireServer(NeckCF,RArmCF,LArmCF)
			db = false
		end
	end))
end)

Here is my client script that handles formulas. I am dead sure its to do with my formulas as I am not a that good with maths.
Left Arm Offset:
image
Right Arm Offset
image

Thank you if you help me on this.

It might just b how the camera works; to test it print the position of the hand and of the gun to find out which bug it is.

its not a bug its a problem with the formula I am using I am asking you to help me fix the formula.

SOLVED!
How do I Make Arms Move with Camera? found this topic its very useful!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.