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.
- Make a local script inside “StarterGui”.
- We will call it weapon switching, but its not that important.
- 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
- We will disable the inventory of the player together with the keybinds.
CoreGui:SetCoreGuiEnabled(Enum.CoreGuiType.Backpack, false) --disabling the backpack/inventory gui
- Now we will lock first person (optional).
game.Players.LocalPlayer.CameraMode = Enum.CameraMode.LockFirstPerson -- locking the players camera in first person (optional)
- 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.