I'm currently making a FPS game right now. Can somebody help me make a non-local script that makes both arms, tools, and the head follow the player's camera. I am decent at scripting but have a hard time comprehending trigonometry. Thank you for reading.
Put this code in a local script in starterpack. I don't think you can do it with non-local scripts. Hope this helps anyways.
plr = game.Players.LocalPlayer; repeat wait() until plr.Character char = plr.Character m = plr:GetMouse() game["Run Service"].RenderStepped:connect(function() local c = game.Workspace.CurrentCamera char.Torso["Right Shoulder"].C0 = CFrame.new(1,0.5,0) * CFrame.Angles(-math.asin((m.Origin.p - m.Hit.p).unit.y),1.55,0) char.Torso["Left Shoulder"].C0 = CFrame.new(-1,0.5,0) * CFrame.Angles(-math.asin((m.Origin.p - m.Hit.p).unit.y),-1.55,0) char.Torso["Neck"].C0 = CFrame.new(0,1,0) * CFrame.Angles(-math.asin((m.Origin.p - m.Hit.p).unit.y) + 1.55,3.15,0) end)``
`
my script is better for FPS: in R6
plr = game.Players.LocalPlayer; -- local script repeat wait() until plr.Character char = plr.Character m = plr:GetMouse() game["Run Service"].RenderStepped:connect(function() local c = game.Workspace.CurrentCamera char.HumanoidRootPart["RootJoint"].C0 = CFrame.new(0,0,0) * CFrame.Angles(-math.asin((m.Origin.p - m.Hit.p).unit.y) + 1.55,3.15,0) char.Humanoid.CameraOffset = (char.HumanoidRootPart.CFrame+Vector3.new(0,0,0)):pointToObjectSpace(char.Head.CFrame.p + Vector3.new(0,-1.46,0)) end)