I am making a FPS and I am stuck on this part. I am not using fake arms; I am editing the CFrames of the joints of the actual player. If anyone can help me with making the arms point towards the camera direction, I would be entirely grateful!
local camera: Camera = workspace.CurrentCamera
local character: Model = player.Character or player.CharacterAdded:Wait() :: Model
local head: BasePart = character:WaitForChild("Head") :: BasePart
local rightUpperArm: BasePart = character:WaitForChild("RightUpperArm") :: BasePart
local leftUpperArm: BasePart = character:WaitForChild("LeftUpperArm") :: BasePart
local rightLowerArm: BasePart = character:WaitForChild("RightLowerArm") :: BasePart
local leftLowerArm: BasePart = character:WaitForChild("LeftLowerArm") :: BasePart
local rightHand: BasePart = character:WaitForChild("RightHand") :: BasePart
local leftHand: BasePart = character:WaitForChild("LeftHand") :: BasePart
local neck: Motor6D = head:WaitForChild("Neck") :: Motor6D
local rightShoulder: Motor6D = rightUpperArm:WaitForChild("RightShoulder") :: Motor6D
local leftShoulder: Motor6D = leftUpperArm:WaitForChild("LeftShoulder") :: Motor6D
local rightElbow: Motor6D = rightLowerArm:WaitForChild("RightElbow") :: Motor6D
local leftElbow: Motor6D = leftLowerArm:WaitForChild("LeftElbow") :: Motor6D
local rightWrist: Motor6D = rightHand:WaitForChild("RightWrist") :: Motor6D
local leftWrist: Motor6D = leftHand:WaitForChild("LeftWrist") :: Motor6D
local neckCFrame: CFrame = neck.C0
local rightShoulderCFrame: CFrame = rightShoulder.C0
local leftShoulderCFrame: CFrame = leftShoulder.C0
local rightElbowCFrame: CFrame = rightElbow.C0
local leftElbowCFrame: CFrame = leftElbow.C0
local rightWristCFrame: CFrame = rightWrist.C0
local leftWristCFrame: CFrame = leftWrist.C0
movementThread = RunService.RenderStepped:Connect(function(): nil
local cameraDirection = camera.CFrame.LookVector
if (isMovementEnabled) then
neck.C0 = neckCFrame * CFrame.Angles(0, -math.asin(cameraDirection.X), 0) * CFrame.Angles(math.asin(cameraDirection.Y), 0, 0)
else -- Default the CFrames
--neck.C0 = neckCFrame
--rightShoulder.C0 = rightShoulderCFrame
--leftShoulder.C0 = leftShoulderCFrame
--rightElbow.C0 = rightElbowCFrame
--leftElbow.C0 = leftElbowCFrame
--rightWrist.C0 = rightWristCFrame
--leftWrist.C0 = leftWristCFrame
end
return nil
end)
``