I'm trying to make it so that when you're in first person (you're always in first person) that when you equip this tool, your arms follow your cursor. Since I want it the joints to update on the server so that other players can see where my arms are pointing, it needs to update on the server. But I have to run it through a localscript because I need to use the camera for this. Since this is going to be done with all tools, I'm using a module for the function. Here are the functions in the module:
it works fine on the client, but it STILL won't update on the server:
Module script: local runservice = game:GetService("RunService")
local leftShoulder local rightShoulder local cam
local function armsLoop() leftShoulder.C0 = CFrame.new(leftShoulder.C0.p) * CFrame.Angles(cam.CoordinateFrame.lookVector.Y + math.rad(90), -math.rad(90),0) rightShoulder.C0 = CFrame.new(rightShoulder.C0.p) * CFrame.Angles(cam.CoordinateFrame.lookVector.Y + math.rad(90), math.rad(90),0) end
function joints:ArmsMoving(torso, camera, move) cam = camera leftShoulder = torso["Left Shoulder"] rightShoulder = torso["Right Shoulder"]
if move then runservice:BindToRenderStep("ArmsLooping", Enum.RenderPriority.Camera.Value-1, armsLoop) else runservice:UnbindFromRenderStep("ArmsLooping") leftShoulder.C0 = CFrame.new(leftShoulder.C0.p) * CFrame.Angles(0, -math.rad(90),0) rightShoulder.C0 = CFrame.new(rightShoulder.C0.p) * CFrame.Angles(0, math.rad(90),0) end
end
Local script: ReturnJoints.OnClientInvoke = function(move) if move then JointModule:ArmsMoving(char.Torso, camera, true) else JointModule:ArmsMoving(char.Torso, camera, false) end print('left shoulder - '..tostring(leftShoulder.C0)) print('right shoulder - '..tostring(rightShoulder.C0)) return leftShoulder.C0, rightShoulder.C0 end
Server script: leftShoulder, rightShoulder = ReturnJoints:InvokeClient(player, true) --// MAKE ARMS MOVE print('left shoulder is '..tostring(leftShoulder)) print('right shoulder is '..tostring(rightShoulder)) char.Torso["Left Shoulder"].C0 = leftShoulder char.Torso["Right Shoulder"].C0 = rightShoulder
Server output: left shoulder is -1, 0.5, 0, 0, 0, -1, 0, 1, 0, 1, 0, 0 right shoulder is 1, 0.5, 0, 0, 0, 1, 0, 1, -0, -1, 0, 0
So the CFrames seem(?) to replicate but setting them won't work!