FPS Arms in my custom camera

I want to make a system where the arms follow the first-person camera in my custom camera setup.

The problem is that the traditional method hasn’t been working properly because the way the camera behaves has been changed.

I’ve tried many solutions, and if anyone knows how to fix this, I would be grateful!

	local function updateCamera(deltaTime)
		
				deltaTime = deltaTime * 60

				local rootMagnitude = Humanoid.RootPart and Vector3.new(Humanoid.RootPart.Velocity.X, 0, Humanoid.RootPart.Velocity.Z).Magnitude or 0
				local calcRootMagnitude = math.min(rootMagnitude, 50)
				if deltaTime > 3 then
					func1 = 0
					func2 = 0
				else
					func1 = lerp(func1, math.cos(tick() * 0.5 * math.random(10, 15)) * (math.random(5, 20) / 200) * deltaTime, 0.05 * deltaTime)
					func2 = lerp(func2, math.cos(tick() * 0.5 * math.random(5, 10)) * (math.random(2, 10) / 200) * deltaTime, 0.05 * deltaTime)
				end

				Camera.CFrame = Camera.CFrame * (CFrame.fromEulerAnglesXYZ(0, 0, math.rad(func3)) * CFrame.fromEulerAnglesXYZ(math.rad(func4 * deltaTime), math.rad(val * deltaTime), val2) * CFrame.Angles(0, 0, math.rad(func4 * deltaTime * (calcRootMagnitude / 5))) * CFrame.fromEulerAnglesXYZ(math.rad(func1), math.rad(func2), math.rad(func2 * 10)))

				val2 = math.clamp(lerp(val2, -Camera.CFrame:VectorToObjectSpace((Humanoid.RootPart and Humanoid.RootPart.Velocity or Vector3.new()) / math.max(Humanoid.WalkSpeed, 0.01)).X * 0.08, 0.1 * deltaTime), -0.35, 0.2)
				func3 = lerp(func3, math.clamp(UserInputService:GetMouseDelta().X, -5, 5), 0.25 * deltaTime)
				func4 = lerp(func4, math.sin(tick() * int) / 5 * math.min(1, int2 / 10), 0.25 * deltaTime)
				if rootMagnitude > 1 then
					val = lerp(val, math.cos(tick() * 0.5 * math.floor(int)) * (int / 200), 0.25 * deltaTime)
				else
					val = lerp(val, 0, 0.05 * deltaTime)
				end
				if rootMagnitude > 12 then
					int = 20
					int2 = 18
				elseif rootMagnitude > 0.1 then
					int = 12
					int2 = 14
				else
					int2 = 0
				end
				vect3 = lerp(vect3, Camera.CFrame.LookVector, 0.125 * deltaTime)
			
		end

		local function updateArms()

				local torso = char:WaitForChild("Torso")
				local rightShoulder = torso:WaitForChild("Right Shoulder")
				local leftShoulder = torso:WaitForChild("Left Shoulder")
				local head = char:WaitForChild("Head")

			local camCF = Camera.CoordinateFrame

			
			local rightArmOffset = camCF * CFrame.new(1, -1, 0) 
			local leftArmOffset = camCF * CFrame.new(-1, -1, 0) 

	
			local rightArmCFrame = torso.CFrame:ToObjectSpace(rightArmOffset)
			local leftArmCFrame = torso.CFrame:ToObjectSpace(leftArmOffset)

		
			rightArmCFrame = rightArmCFrame * CFrame.Angles(0, math.pi / 2, 0)
			leftArmCFrame = leftArmCFrame * CFrame.Angles(0, -math.pi / 2, 0)

	
			rightShoulder.C0 = rightShoulder.C0:Lerp(rightArmCFrame, updateSpeed)
			leftShoulder.C0 = leftShoulder.C0:Lerp(leftArmCFrame, updateSpeed)
			

		end

		game:GetService("RunService"):BindToRenderStep("FpsSmooth", Enum.RenderPriority.Character.Value, function(deltaTime)
			if shiftlock == false then
				updateCamera(deltaTime)
				updateArms()	
			end
			
			
			plr.CameraMode = Enum.CameraMode.LockFirstPerson
		end)
2 Likes