How to make character's arms follow mouse

I want the player’s right arm to move with the mouse on BOTH the x and y axis.
I have figured out only how to move the y axis… and I think because the character can do a full 360 with the x axis of their mouse.hit.p this happens:

local RightShoulder = Character.Torso:WaitForChild("Right Shoulder")

		local dir = Mouse.Hit.Position - Mouse.Origin.Position
		local angle = math.atan2(dir.Y, math.sqrt(dir.X^2+dir.Z^2))
		local Xangle = math.atan2(dir.X, math.sqrt(dir.Z^2+dir.Y^2))
		local rotationCf = CFrame.Angles(angle, -Xangle, 0)
		RightShoulder.C0 = CFrame.new(1, 0.5, 0) * rotationCf * CFrame.Angles(math.rad(0), math.rad(90), math.rad(0))

bumping because I need help and saying this bcz there’s a character minimum

I should’ve used the 2D mouse vector instead of it’s 3D ones.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.