Rotating arms relative to third-person camera movement

Hi, I’m doing a third person gun, I’m trying to make the arms follow the camera’s Y rotation, but I’m not succeeding, could you fix my script for both arms to follow the camera’s Y rotation.

The script is here:

Script
local cam = workspace.CurrentCamera

local plr = game.Players.LocalPlayer

local char = plr.Character or plr.CharacterAdded:Wait()
local hrp = char:WaitForChild("HumanoidRootPart")

local arm = char:FindFirstChild("RightShoulder", true)

local y = arm.C0.Y


game:GetService("RunService").RenderStepped:Connect(function()
		
	if arm then
		
		local camDirection = hrp.CFrame:ToObjectSpace(cam.CFrame).LookVector
			
		arm.C0 = CFrame.new(0, y, 0) * CFrame.Angles(0, -camDirection.Y, 0)
	end
end)
1 Like