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.
✓ ANSWER ACCEPTED
Making both arms, tools, and the head follow the player's camera?
2 answers
✓ Accepted answer
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)``
`
4 comments
0
I don't know if this works with R6, but it definitely doesn't with R15.
0
It worked for me (I use R6).
0
Hm. I'll test it out. If it does work, if someone could please post a script like this for R15, I'd be very appreciative.
0
@lunatic5 try this: https://pastebin.com/Rg7Z5pMW
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)
This discussion is preserved as it was. New answers, comments, and votes are closed.

4 comments
https://devforum.roblox.com/t/rotating-a-characters-head-to-match-camera-rotation/59784
I was actually looking for this, too. Thanks! However, how would I make the arms and tool (in my case a gun) follow the camera like R0B0T_K1LLER is asking?
try: 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.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+Vect
is there a r15 script for this