How to make arm follow mouse and rotating relative to the shoulder position and rotate Y axis locally based on movement of mouse

Hello,
I want the arm to move like any normal human arm would. I used your script and modified it for R6
(Here’s my thread)

And the arm rotates itself based on the local Y axis and that’s not how a normal human arm would move when pointing side to side. The local Y axis itself doesn’t move unless you want to turn a knob or something.


I encountered another issue while making the script R6. The arm rotates relative to its original position instead of the shoulder joint. I basically want the arm to rotate its local y axis based on the movement of the mouse.
- Br, iSyriux

1 Like

Hello,
My script, btw

wait(2)

local Players = game:GetService("Players")

local RunService = game:GetService("RunService")

local plr = Players.LocalPlayer

local char = plr.Character

local mouse = plr:GetMouse()

mouse.TargetFilter = workspace

local armOffset = char.Torso.CFrame:Inverse() * char["Right Arm"].CFrame

local armWeld = Instance.new("Weld")

armWeld.Part0 = char.Torso

armWeld.Part1 = char["Right Arm"]

armWeld.Parent = char

local lastmou

RunService.RenderStepped:Connect(function()

lastmou = mouse.Hit.p

local cframe = CFrame.new(char.Torso.Position, mouse.Hit.Position) * CFrame.Angles(math.pi/2, 0, 0)

armWeld.C0 = armOffset * char.Torso.CFrame:toObjectSpace(cframe)

end)

Hello,
Basically this is what I am talking about when I talk about relative to the mouse motion

Hello,

Maybe here you should try to set another CFrame value then set the C0 to be the correct position. So then after doing this you can replace char.Torso.Position with this CFrame value so it will be at the correct location.

If this helped, you’re welcome, if it didn’t I’m sorry and I wish you the best of luck to fix this issue!

Hello,
Can you reiterate? I understood nothing you said. Not only did you not provide any examples but I’ve already experimented with offset. Offset doesn’t work for the part itself only the point it is rotation relatively to about.

Hello,
Your post did not help sadly :frowning:But thanks for replying I hope to find a working post

Hello,
Any help is appreciated! :smiley:

Hello,
I have been this problem for 4 days with no help! ;(
I need help, and without bumping no one would notice me say this!

Hello,
Why is no one helping me? Just why?
Absolutely no one is even paying attention to my posts

Do you want something like this?

Hello,
Yes, but the arm actually moves in a bezier path as opposed to a linear one for a smoother look, and it orientates based on the motion of the mouse

Hello,
So say the arm is holding a sword. You don’t want the local Y axis to just stay in one place because you won’t be able to slash anyone. If you’re moving your arm from left to right, you also want to rotate it so that it penetrates through the opponent

I understand what you mean but I can’t think of an easy way to implement this

Hello,
If you can’t do it can you ask around for help, I have been stuck this problem for [color=“FF3434”]84 days![/color]

Ok thats a VERY old topic but here is the solution

wait(2)

local Players = game:GetService("Players")

local RunService = game:GetService("RunService")

local plr = Players.LocalPlayer

local char = plr.Character

local mouse = plr:GetMouse()

mouse.TargetFilter = workspace

local armOffset = char.Torso.CFrame:Inverse() * char["Right Arm"].CFrame

local armWeld = Instance.new("Weld")

armWeld.Part0 = char.Torso

armWeld.Part1 = char["Right Arm"]

armWeld.Parent = char

local lastmou

RunService.RenderStepped:Connect(function()
	lastmou = mouse.Hit.p

	local cframe = CFrame.new(char.Torso.Position, mouse.Hit.Position) * CFrame.new(0,0.5,-0.5) * CFrame.Angles(math.pi/2, 0, 0)

	armWeld.C0 = armOffset * char.Torso.CFrame:toObjectSpace(cframe)
end)
3 Likes