As stated in a comment, you want the arm to point where the mouse goes. Here is the script that I use, but without remote-events and it misses alot of the necessary variables. I'll explain what you need and the problems with the script, but I don't have Studio right now so I can't confirm anything.
local Shoulder = Character.Torso["Right Shoulder"]
local ShoulderOffset = CFrame.new()
local Mouse = Player:GetMouse()
game:GetService("RunService").RenderStepped:Connect(function()
local MouseLookVector = Mouse.LookVector
Shoulder.C0 = ShoulderOffset * CFrame.Angles(0,0,0) * CFrame.Angles(-math.asin(MouseLookVector.Y),0,0)
end)
ShoulderOffset isn't actually a blank CFrame. You can get the actual offset by printing the C0 of the RightShoulder Motor6D in a Dummy. You'll need to use the command bar for this.
I haven't defined Player, Character so you'll need to do those.
In the first CFrame.Angles. One of the values will be pi/2 or 90 degrees because otherwise the arm won't be pointing straight at the mouse and I forget which axis it needs to be offset on. Similarly, it is possible that the X axis isn't the proper axis to rotate the arm on, in which case you can try switching it to the Y or Z axis. It's also possible that there shouldn't be a minus because otherwise the arm will move opposite the mouse (pointing up will move the arm down); interesting thing to note is that if the right arm has a negative arcsin then the left arm will have a positive one.
This won't replicate to the server, you'll need remote events for those.
There won't be a way to stop this you will have to script it yourself but it should be easy.
5 comments
uhm, quick question, why are you doing this? I think it would be a lot easier to use CFrames.
Unless I'm thinking of something totally different here
i have to get the angle so that i can use it with the Motor6D:SetDesiredAngle(number) function which only works with a singular number, not an entire cframe
This might have something to do with positions based on world position vs. relative positions. You should use CFrames for this, and if you're doing what I think you are, moving the arm to look at the mouse then I can give you a few pointers for this.
thats exactly what im trying to do