Issue with arms and head follow mouse script

I am having an issue with a script that makes the players head and arms follow the mouse on the Y axis. The head and right arm work fine, but the left arm does not follow the mouse, instead, it goes in the opposite direction of where the mouse is facing.

Heres a video showing the problem:
robloxapp-20210906-2129352.wmv (1.8 MB)

script:

repeat wait() until workspace:findFirstChild(game.Players.LocalPlayer.Name)
wait()

local cam = workspace.CurrentCamera
local player = game.Players.LocalPlayer
local char = player.Character
local hastool = false
local armweld = player.Character.Torso["Right Shoulder"]
local armweld2 = player.Character.Torso["Left Shoulder"]
local origarmweldcf = armweld.C0
local origarmweld2cf = armweld2.C0
local basearmweldcf = origarmweldcf + Vector3.new(0,0.25,-0.25)
local basearmweldcf2 = origarmweld2cf + Vector3.new(0,0.25,-0.25)
local baseheadweldcf = char.Torso.Neck.C1
local heading, attitude, bank

--check to see if the player is holding a tool
function holdingtool()
	for _,instance in ipairs(char:GetChildren()) do
		if instance:IsA("Tool") then
			return true
		end
	end
end

cam.Changed:connect(function()	
	
	--get heading, attitude, bank, etc
	--http://wiki.roblox.com/index.php?title=Heading,_attitude,_and_bank
	local sx, sy, sz, m00, m01, m02, m10, m11, m12, m20, m21, m22 = cam.CoordinateFrame:components()
	heading = math.atan2(m02, m22)
	attitude = math.asin(-m12)
	bank = math.atan2(m10, m11)
	
	--rotate arm
	if hastool then
		armweld.C0 = basearmweldcf*CFrame.Angles(0,0,attitude)
		armweld2.C0 = basearmweldcf2*CFrame.Angles(0,0,attitude)
	end
	
	
	--roate head
	char.Torso.Neck.C1 = baseheadweldcf*CFrame.Angles(attitude,0,0)
	
end)

--create weld if tool is equipped
char.ChildAdded:connect(function(child)
	if child:IsA("Tool") then
		hastool = true
		armweld.C0 = basearmweldcf*CFrame.Angles(0,0,attitude) --pivot around the axis of the head
		armweld2.C0 = basearmweldcf2*CFrame.Angles(0,0,attitude)
		--armweld.C1 = CFrame.new(0,0.75,-.5) --adjust down (left/right, forward/back, up/down)
	end
end)

--remove weld if no tool is found in character
char.ChildRemoved:connect(function()
	wait() --allow time for tool swapping
	if not holdingtool() then
		hastool = false
		armweld.C0 = origarmweldcf
		armweld2.C0 = origarmweld2cf
	end
end)
1 Like

u put the same code im the base arm try putting 0.25 (only 1 not both)
example:
Vector3.new(0,-0.25,0.25)
(put only 1 not both or else it will probably break