So I'm attempting to make a thing that makes the right arm of the player point towards the mouse. I have been successful in doing this, however, it is a pretty bad technique for doing so. I've learned that you could use the Motor6D Right Shoulder located in the characters torso for a smoother way of doing so (I've made the script based off of position). Does anyone know a way of doing so?

This is what I have so far:

function pointArms(t, a, p, c0, c1)
	local offset = (t.CFrame*CFrame.new(c0)).p -- find offset
	local dir = (mid - p).unit -- find direction 
	local rot = CFrame.fromEulerAnglesXYZ(math.pi / 2, 0, 0)
 	local rightangle = CFrame.fromEulerAnglesXYZ(0, 0, math.pi)
	local pos = CFrame.new(c1) -- position
	ra.CFrame = CFrame.new(offset, offset + dir) * rot * pos * rightAngle -- Changes position. However, the goal is to make this change the right shoulder in torso for a smoother effect.
end

1 comment

0

does the argument a do anything in the function? is ra in line 7 a typo that should be a?