So, I'm making a gun for an FPS. I already have the script for showing the FPS arms, and animations, etc. I'm just having trouble with having the arms follow the camera. Basically, I want the torso to move to the Y point of the camera but I don't want the legs to move with the torso. I have this code here:
mouse.Move:connect(function() mouse.TargetFilter = game.Workspace torso.CFrame = CFrame.new(torso.Position, Vector3.new(mouse.Hit.p.X, mouse.Hit.p.Y, mouse.Hit.p.Z)) end)
It works decently, but if your arms touch the ground then it like flings you and makes you fall. Also, the entire body moves; like, the legs also float with the torso. I want the legs to stay flat on the ground, and only have the torso move up and down on the Y axis according to the Y of the mouse. I was thinking of making the head move with the Y and welding the arms to the head, but I'm not sure to do that. Could anyone help me please? Thanks!
for FPS I prefer to use R6 real arms this is my local script:
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+Vector3.new(0,0,0)):pointToObjectSpace(char.Head.CFrame.p + Vector3.new(0,-1.46,0)) end)