Hello again guys, i finaly found a good way to close this topic!
I modified the formula, and now it works nicely for arms, but it doesnt for the tool, so i decided to modify the motor6D of the toolHandle, so that the Part0 is now the RightArm.
Now, with this new motor6D, your tool will be attached at your arm, that follows the mouse, so, arms, and tool follow the mouse now!
This is a pretty easy way to animate too! You will not find yourself in difficulty with animating, trust me!
So, how did i modify the formula?
I saw that with the normal formula, the arm turned for itself, and it was because, the formula added in loop the angle that was needed for the arm to turn towards the mouse:
Torso["Right Shoulder"].C0 = Torso["Right Shoulder"].C0 * CFrame.Angles(math.asin((mouse.Hit.p - mouse.Origin.p).unit.y), 0, 0)
therefore it can be understood that by always adding the same angle, the arm turns on itself. So I had an idea, first of all i got the angles of “Torso[“Right Shoulder”].C0” just by doing “local rightX, rightY, rightZ = self.char.Torso[“Right Shoulder”].C0:ToEulerAnglesYXZ()”, then i took this: “Torso[“Right Shoulder”].C0” and i substracted the negative Z angle that i took from the :ToEulerAnglesYXZ() function.
Then i put this micro formula in brackets, and i added the new angles of the mouse.
Sorry, im not very good for explaining, specialy in english, so i will give you the finished formula:
run.RenderStepped:Connect(function()
if equipped then
local rightX, rightY, rightZ = self.char.Torso["Right Shoulder"].C0:ToEulerAnglesYXZ()
self.char.Torso["Right Shoulder"].C0 = (self.char.Torso["Right Shoulder"].C0 * CFrame.Angles(0, 0, -rightZ)) * CFrame.Angles(0, 0, math.asin((self.mouse.Hit.p - self.mouse.Origin.p).unit.y))
local leftX, leftY, leftZ = self.char.Torso["Left Shoulder"].C0:ToEulerAnglesYXZ()
self.char.Torso["Left Shoulder"].C0 = (self.char.Torso["Left Shoulder"].C0 * CFrame.Angles(0, 0, -leftZ)) * CFrame.Angles(0, 0, math.asin((-self.mouse.Hit.p - -self.mouse.Origin.p).unit.y))
end
end)
Here’s a video of how it should work:
I hope this was helpful for you guys!
EDIT:
After 3 years, i wanted to thank you all for supporting this reply so much! I wrote this when i didn’t have much experience, and once i found the working formula, i just posted it here. So before just taking for granted, check out the problem yourself and try to find a better way to do it, just take this as a start.
Unfortunately, i won’t be answering anything anymore since i stopped being an active developer on roblox. Thanks again!