I am not particularly familiar with Motor6D’s, so I need help making the arms follow the camera properly. My current method makes the arms follow the camera at a weird angle, which I suspect is an issue with the rig. Attachments below :
I have searched around the forum for a while that addresses my exact issue, but to no avail.
Client side
local RunService = game:GetService('RunService')
local Event = script:WaitForChild('LookEvent')
local Player = game.Players.LocalPlayer
local Camera = workspace:WaitForChild('Camera')
local lookVectorY
local function checkMouseLocation()
lookVectorY = Camera.CFrame.LookVector.Y
Event:FireServer(lookVectorY)
end
RunService.RenderStepped:Connect(checkMouseLocation)
Server side
local Event = script.Parent:WaitForChild('LookEvent')
local Character = script.Parent.Parent
local plrFromCharacter = game.Players:GetPlayerFromCharacter(Character)
local Head = Character:WaitForChild('Head')
local Humanoid = Character:WaitForChild('Humanoid')
local rightShoulder = Character:WaitForChild("Torso"):WaitForChild("Right Shoulder")
local leftShoulder = Character:WaitForChild("Torso"):WaitForChild("Left Shoulder")
function rotateShoulder(shoulder, lookvectorY)
local shoulderC1 = shoulder.C1
local shoulderC1Vector = shoulderC1.Position
shoulder.C1 = CFrame.new(shoulderC1Vector) * CFrame.Angles(0,0,lookvectorY)
end
local function onConnect(plr, lookVectorY)
if plr ~= plrFromCharacter then return end
if plr:FindFirstChild("didSpawn") and plr.didSpawn.Value == true then
rotateShoulder(rightShoulder,lookVectorY)
rotateShoulder(leftShoulder,lookVectorY)
end
end
Event.OnServerEvent:Connect(onConnect)