How to make arm rotate as mouse rotates and rotate to the mouse's motion to make swordswings possible

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.

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)

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


Diagram:


- Br, iSyriux

Hello,
Basically what I am talking about with rotating the arm based on the motion of the mouse is take this analogy.
When you swing a sword, you don’t want to keep pointing it upwards. You want to rotate your arm’s local y axis relative to the direction you’re swiging the sword to slash your opponents.