How to make an FPS prototype the easy way

My first ever tutorial and my third ever post in roblox dev forum, so be sure to point out any script errors and all.

Disclaimer: This is not the right way on how to make an fps framework on roblox, I just made this tutorial because some of you are still starting out with scripting and want to make an fps game.

Section 1. Setting up

  • Creating a place
    First thing you will need to set up a blank place and publish it.

  • Game Settings
    Now press the game settings navigate to the avatar tab and then chose the avatar to be R6.

Section 2. The gun system

  • Choosing the right one
    Choosing a gun system can be hard, I recommend chose one that is flexible, easy to set up, is tool based and customizable.

  • The setting up
    For the sake of this tutorial I will be using “Warbound” system, to be precise this model that isn’t broken here

As of now we already have a working gun, but what if we hid the inventory? The it would look a lot cooler!

Section 3. The scripting

  • Hiding the inventory
    It’s pretty easy to hide the inventory of a player with one simple local script inside any of the player services like: starter pack, starter gui, etc.
    But when you hide the inventory of the player, the keybinds unbind.
    To fix this we will re-bind the keybinds with user input service.

So let’s start with the script.

  1. Make a local script inside “StarterGui”.
    image
  2. We will call it weapon switching, but its not that important.
    image
  3. We will start by assigning the variables.
local uis = game:GetService("UserInputService") --we will use this to find out when the player presses 1, 2, 3 etc.
local plr = game.Players.LocalPlayer --the player
local character = plr.Character -- the character of the player
local Humanoid = character:WaitForChild("Humanoid") --the humanoid
local Equipped = false --not in use
local CoreGui = game:GetService("StarterGui") --inventory is a part of the core gui
  1. We will disable the inventory of the player together with the keybinds.
CoreGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false) --disabling the backpack/inventory gui
  1. Now we will lock first person (optional).
game.Players.LocalPlayer.CameraMode = Enum.CameraMode.LockFirstPerson -- locking the players camera in first person (optional)
  1. Keybinding!
uis.InputBegan:Connect(function(Input)
	if Input.KeyCode == Enum.KeyCode.One then
		Humanoid:EquipTool(plr.Backpack:FindFirstChild("Tool name here")) --put your tools name here
	end
end)

6.1 If you want different tools use this script

uis.InputBegan:Connect(function(Input)

	if Input.KeyCode == Enum.KeyCode.One then
		Humanoid:UnequipTools("Tool 2 name here")
		Humanoid:EquipTool(plr.Backpack:FindFirstChild("Tool 1 name here"))
	end

	if Input.KeyCode == Enum.KeyCode.Two then
		Humanoid:UnequipTools("Tool 1 name here")
		Humanoid:EquipTool(plr.Backpack:FindFirstChild("Tool 2 name here"))

	end
end)

If you want more tools just add another portion starting with the “if Input.KeyCode”
The end script should look like this:

local uis = game:GetService("UserInputService")
local plr = game.Players.LocalPlayer
local character = plr.Character
local Humanoid = character:WaitForChild("Humanoid")
local Equipped = false
local CoreGui = game:GetService("StarterGui")

CoreGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false)
game.Players.LocalPlayer.CameraMode = Enum.CameraMode.LockFirstPerson

uis.InputBegan:Connect(function(Input)
	if Input.KeyCode == Enum.KeyCode.One then
		Humanoid:EquipTool(plr.Backpack:FindFirstChild("M16 M203"))
	end
end)

At this point your gun system is ready!

I will leave a link to the place down below.
The place.

Thank you for reading please let me down below if there are any script or writing errors.

I made everything myself except the gun and the system.

Section 4. Outro
All the links just incase you missed them:
The gun: M16 M203 (Warbound) - Roblox
The place: Tutorial FPS - Roblox

Once again thank you for reading, sorry for any errors or mistakes this is my first tutorial.

Edit:
I am thinking of making a more advanced tutorial for more advanced folks, so if you want it just leave a reply or a like.
P.S I will probably still do it even if no one replies or likes, I just like helping people out.

P.P.S You don’t need to give me credit if you use my place, but it would be nice.

14 Likes

Sorry for people that grabbed the game I forgot to publish the updates, now its published and should work. :stuck_out_tongue_winking_eye:

3 Likes

This is pretty good, keep up the good work!

You can check out the new tutorials here, planning on making the third part!
Also thanks!

Is there a way to swap weapons?

Yup heres an example, im pretty sure i posted this in there

uis.InputBegan:Connect(function(Input)
    if Input.KeyCode == Enum.KeyCode.One then
        Humanoid:UnequipTools()
        Humanoid:EquipTool(plr.Backpack:FindFirstChild("M16 M203"))
    elseif Input.KeyCode == Enum.KeyCode.Two then
        Humanoid:UnequipTools()
        Humanoid:EquipTool(plr.Backpack:FindFirstChild("YourSecondToolHere"))
    end
end)

Pretty sure this should work.

1 Like

Thanks, I appreciate it alot but i meant that a sort of dropped tool that gets added as a 3rd weapon, is there a solution to destroy and replace the gun you already have equipped?

Example:

There is deffo a way but i really don’t know how, you could make a pickup system and have three variables for primary, secondary, etc. and on pick up change the value to that and on the equip script check if the gun you are equipping is a thing. There are about a million of ways you could do this, with the pick up system just google roblox e to pick up or something, can’t help you with anything else though.

Alright, that’s no problem. thanks for your time anyway.