[GOAL]
My goal is to get the players Left Arm to point towards a part named "LeftArmHold" inside all the tools within my game. (Make it so the left arm will grip the gun without having to script the CFrame for each tool)
[PROBLEM]
The left arm points backwards and looks upwards.
[SCRIPT]
I have tried a few ways of doing this but all have failed, this is my most recent attempt.
la.C0 = (la.Parent.CFrame:toObjectSpace(local_utl.torso.CFrame,la_hold.CFrame))
(Here are the variables in case you get confused)
la = char["Left Arm"].la_weld local_utl.torso = --[The player's torso] la_hold = tool["LeftArmHold"]
May I also state, I am a newbie to CFraming and only just got an understanding of :toObjectSpace and believe I am using it wrong and or not meant to be using it for this situation.
Short introduction of radians:
math.pi = 3.14 -- +unlimited decimals
pi radians equals 180 degrees, so to flip your arm over an axis you need to do
CFrame.Angles(math.pi,0,0)
pi/2 radians equals 90 degrees, so its just a quarter turn, so to rotate your arm over an axis you need to do.
CFrame.Angles(math.pi/2,0,0)
Source: http://wiki.roblox.com/index.php?title=CFrame#Radians
la.C0 = (la.Parent.CFrame:toObjectSpace(local_utl.torso.CFrame,la_hold.CFrame))*CFrame.Angles(math.pi,0,0)
It's possible that this does not directly solve the problem, you could try to move math.pi sometimes and maybe divide it by 2 until the arm is in the right place.