So i've struggled for weeks on how to create a FPS gun, I know how to create the gun itself so that it can fire, reload and such but its the thing that makes the arms, head follow either my mouse or the camera.
An example:
plr = game.Players.LocalPlayer
char = plr.Character
torso = char:WaitForChild("Torso")
sh = {torso["Right Shoulder"], torso["Left Shoulder"]}
arms = {char["Right Arm"], char["Left Arm"]}
t = script.Parent
h = t.Handle
eq = false
t.Equipped:connect(function()
sh[1].Part1 = nil
local w = Instance.new("Weld", torso)
w.Name = "RA_weld"
w.Part0 = arms[1]
w.Part1 = torso
w.C0 = arms[1].CFrame:inversse()
w.C1 = torso.CFrame:inverse()
eq = true
end)
while wait() do if eq then
local targ = (cam.CoordinateFrame*CFrame.new(0,0,-100)).p
w.C0 = CFrame.new(headpos.p,targ) -headpos.p
end end

1 comment
I do not know how to do this, but I would like to know. You really should tab your code correctly, however.