There are MANY posts with issues similar to mine. However, after searching extensively, I could not find a post that gives a straight forward answer to solve this issue. Here is my situation:
local character = workspace.Rig
local targetPos = Vector3.new()
local rightShoulder = character.Torso['Right Shoulder']
local leftShoulder = character.Torso['Left Shoulder']
rightShoulder.Enabled = false
leftShoulder.Enabled = false
local rightWeld = Instance.new('Weld')
rightWeld.Part0 = character.Torso
rightWeld.Part1 = character['Right Arm']
rightWeld.C0 = CFrame.new(1, 0.5, 0)
rightWeld.C0 *= CFrame.Angles(0, math.pi / 2, 0)
rightWeld.C1 = CFrame.new(-0.5, 1, 0)
rightWeld.C1 *= CFrame.Angles(0, math.pi / 2, 0)
rightWeld.Name = 'RightShoulder'
rightWeld.Parent = character.Torso
local leftWeld = Instance.new('Weld')
leftWeld.Part0 = character.Torso
leftWeld.Part1 = character['Left Arm']
leftWeld.C0 = CFrame.new(-1, 0.5, 0)
leftWeld.C0 *= CFrame.Angles(0, -math.pi / 2, 0)
leftWeld.C1 = CFrame.new(0.5, 1, 0)
leftWeld.C1 *= CFrame.Angles(0, -math.pi / 2, 0)
leftWeld.Name = 'LeftShoulder'
leftWeld.Parent = character.Torso
To explain what I have so far, I have begun by referencing and disabling the motor6d’s that connect the character’s arms. Secondly, I created welds to take the place of the motor6d’s which also prevents arms from being animated. Afterwards, I set the C0 and C1 of each weld to whatever values they were on their respective motor6d (Note: It appears that for the C1 and C0 values of each motor6d, there is a 90 degree rotation on the y-axis. For the left side its a -90 degree rotation on the y-axis.). Lastly, I set the name and parent the welds to the torso of the character.
The issue I am faced with is that, even after extensively looking on the Devforum, I could not figure out a way to rotate the C1 value to make the arm face towards a position. I thought about using trigonometry but those trig functions are very expensive (for what I have heard). I need a solution that is the most straight-forward approach with the least code possible and IDEALLY USES NO TRIG FUNCTIONS (if that is possible). Please don’t suggest CFrame.lookAt()
if you think this post is about making a part face a position.
Also, because there are many scripters with this similar issue, I have worded the title of the post such so that it most likely is to pop up when someone researches their similar issue. Being so, please explain your solution because it is very appreciated!
Thanks for the help!