Arms following mouse direction help

Normal (how it should be):
https://gyazo.com/084b2a2950275e560cd0a98253c4f6b6

When facing different directions:
https://gyazo.com/4e366c60681d7aa93b4fb3b6c964102d
For example if I am 180 degrees from ^Normal then it changes it the opposite way.

Code:

local t1
local t2

local function Tween(speed,t,part,c0)
	pcall(function()t:Cancel()end)
	t = TS:Create(part,TweenInfo.new(speed,Enum.EasingStyle.Linear,Enum.EasingDirection.Out),{C0 = c0})
	t:Play()
end
Tween(0.1,t1,Character.Torso["Left Shoulder"], CFrame.new(-1,0.5,0) * CFrame.Angles(-math.asin((Mouse.Origin.p - Mouse.Hit.p).unit.y),-1.55 + math.asin((Mouse.Origin.p - Mouse.Hit.p).unit.x),0) )
Tween( 0.1,t2,Character.Torso["Right Shoulder"], CFrame.new(1,0.5,0) * CFrame.Angles(-math.asin((Mouse.Origin.p - Mouse.Hit.p).unit.y),1.55 + math.asin((Mouse.Origin.p - Mouse.Hit.p).unit.x),0) )

My second question:
I plan to make this replicate to other players through remote events as well as head movement. What is the best way to do this? The game will probably have a maximum of 40 players at a time so I’m not sure how to do this without ruining performance.

3 Likes

Fixed title so it makes more sense

Seems that it works on the y axis fine, but rotating the arms using unit.x as well doesn’t seem to work right and unless your character is facing in a certain direction it doesn’t do as it should.