Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Making both arms, tools, and the head follow the player's camera?

Asked by 5 years ago

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.

0
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? lunatic5 409 — 5y
0
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 Newh0hrizonCz 58 — 3y
0
is there a r15 script for this bruce_matthew 4 — 3y

2 answers

Log in to vote
0
Answered by 5 years ago

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)``

`

0
I don't know if this works with R6, but it definitely doesn't with R15. lunatic5 409 — 5y
0
It worked for me (I use R6). R0B0T_K1LLER 0 — 5y
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. lunatic5 409 — 5y
0
@lunatic5 try this: https://pastebin.com/Rg7Z5pMW RFL890 4 — 3y
Ad
Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

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)

Answer this question