How to make the player's hand face the mouse

I want to be able to make the player’s right hand face the camera, as shown below:

The wall with the elevator door is the back surface:
image

However, when I am facing the wall on the left surface:
image

The hand no longer successfully follows the mouse, and is instead offset by about 90 degrees:

I’ve been troubled with this problem for long enough now. I’ve not found any discussions on making the hand face the camera, but instead the head or arm. I’ve taken ideas from both solutions and neither is really working for me.

Here is the code I am currently using, for reference:

local rightWrist = player.Character.RightHand.RightWrist
local rightWristC0 = rightWrist.C0
RunService.RenderStepped:Connect(function()
		--> Rotate the player's wrist to face the mouse
		local lookAt = mouse.Hit.Position
		local direction = (lookAt - rightWrist.Parent.Position).Unit
		rightWrist.C0 = rightWristC0 * CFrame.new(Vector3.new(), Vector3.new(-direction.X, direction.Y, direction.Z)) * CFrame.Angles(math.rad(90), 0, 0)
        --^ direction.X is negative, else the hand will face the opposite direction on that axis
	end)
end

Thank you!

2 Likes

Try messing around by adding or subtracting 90 from one of the X,Y,Z angles at a time.