How do I make a Third Person Shooter?

You can write your topic however you want, but you need to answer these questions:
I’m currently trying to make a third person shooter in roblox, similar to Fortnite or GTAs combat. Currently I have a simple gun system with raycasts and the springSystem. However, I’m getting hung up on arm movement. I don’t know where to start. I’ve tried looking at the developer forum but haven’t come up with anything. I know some stuff about CFrames but I’m not a pro on that topic specifically. Any help is appreciated!

Here is a script I use for my games for arm movement following the cursor.

local runService = game:GetService("RunService")

char:FindFirstChildWhichIsA("Humanoid").CameraOffset = Vector3.new(0,0,0) -- x = side to side, y = up and down, z = forward and back

runService.RenderStepped:Connect(function()
	if char:FindFirstChildWhichIsA("Humanoid").Health > 0 then
		local camCFrame = char.HumanoidRootPart.CFrame:toObjectSpace(plrCam.CFrame).LookVector
		char.Torso.Neck.C1 = CFrame.new(0, -.5, 0) * CFrame.Angles(0,math.asin(camCFrame.X)+135,0) * CFrame.Angles(math.asin(camCFrame.Y)+42.5,0,0)
		char.Torso["Right Shoulder"].C0 = CFrame.new(1, .5, 0) * CFrame.Angles(45,-55,math.asin(camCFrame.Y)-45) * CFrame.Angles(0,0,0)
		char.Torso["Left Shoulder"].C0 = CFrame.new(-1, .5, 0) * CFrame.Angles(-45,55,-math.asin(camCFrame.Y)-45) * CFrame.Angles(0,0,0)
	else
		task.wait()
	end
end)

This makes the arms and head point at the cursor. However, it will keep the object in that position even if a animation is playing.

Here is a modified script:

local plr = game.Players.LocalPlayer
local char = plr.Character
local plrCam = workspace.CurrentCamera
local runService = game:GetService("RunService")

char:FindFirstChildWhichIsA("Humanoid").CameraOffset = Vector3.new(0,0,0) -- x = side to side, y = up and down, z = forward and back

for	_,v in pairs(char:GetChildren()) do
	if v:IsA("Part") and v.Name == "Right Arm" then
		print(v)
		v.LocalTransparencyModifier = 0
		v:GetPropertyChangedSignal("LocalTransparencyModifier"):Connect(function()
			v.LocalTransparencyModifier = 0
		end)
	end
end

runService.RenderStepped:Connect(function()
	local camCFrame = char.HumanoidRootPart.CFrame:toObjectSpace(plrCam.CFrame).LookVector
	char.UpperTorso.Waist.C1 = CFrame.new(0, -.5, 0) * CFrame.Angles(0, math.asin(camCFrame.X), 0) * CFrame.Angles(-math.asin(camCFrame.Y), 0, 0)
end)

This will move the entire torso rather than the arms and head. This shouldn’t interfere with any animations that use only the arms.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.