How to make a lazy fps shooter. Part 1

:warning: This tutorial is outdated, instead follow this one Making a simple fps framework. Part 1

This is not good as like those gun fps kits on the toolbox
Its night for me right now of making this post so this is going be in parts.

Step 1: Getting the viewmodel in to our camera
This is most easy part of making a lazy fps shooter.

So lets start of getting our viewmodel:
p1rgfggf

Heres a file for this:
coolViewModel.rbxm (12.1 KB)

Also you may notice theres animations for this viewmodel that I made. You can use thoses.

Ok once you got that done make a folder in ReplicatedStorage called Viewmodels and put the model you imported into the Viewmodels folder.

Now make a module in ReplicatedStorage called FPS.

It should look like this:
dsfdsfP2

Go in your FPS module and type this:

local module = {}

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RS = game:GetService("RunService")
local Viewmodels = ReplicatedStorage:WaitForChild("Viewmodels")
local viewModel : Model

function module:EquipGun(Name)
	viewModel = Viewmodels:WaitForChild(Name):Clone()
	viewModel.Parent = workspace.CurrentCamera
end

RS.RenderStepped:Connect(function()
	if viewModel then
		viewModel:SetPrimaryPartCFrame(workspace.CurrentCamera.CFrame)
	end
end)

return module

Now make a localscript in StarterPlayerScripts and then type this :

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local FPS = require(ReplicatedStorage:WaitForChild("FPS"))

FPS:EquipGun("ViewmodelAim")

And there you go!

Step 2: Animations

Now since theres already animations in the viewmodel go publish the animations.

Now add this to your FPS module:

function module:animate(type)
	if type == "Idle" then
		if viewModel then
			viewModel.AnimationController:LoadAnimation(viewModel.AnimationController.Idle):Play()
		end
	end
end

Now your module should look like this :

local module = {}

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RS = game:GetService("RunService")
local Viewmodels = ReplicatedStorage:WaitForChild("Viewmodels")
local viewModel : Model

function module:animate(type)
	if type == "Idle" then
		if viewModel then
			viewModel.AnimationController:LoadAnimation(viewModel.AnimationController.Idle):Play()
		end
	end
end


function module:EquipGun(Name)
	viewModel = Viewmodels:WaitForChild(Name):Clone()
	viewModel.Parent = workspace.CurrentCamera
	module:animate("Idle")
end



RS.RenderStepped:Connect(function()
	if viewModel then
		viewModel:SetPrimaryPartCFrame(workspace.CurrentCamera.CFrame)
	end
end)

return module

Also change the animation id to this:

And you got this!

END!

Now in the next part we will be doing extra animations and shooting!

21 Likes

Super helpful! I really need this!

3 Likes

This is a nice and simple tutorial for people that wants to make simple fps games. I hope this gets noticed by the public!

4 Likes

Thanks alot! I have made fps games before. Its night for me so I have to sleep.

3 Likes

You should explain some things. It’s bad for someone just to take code, and then later on not understand how to modify it and end up getting demotivated.

4 Likes

Okay I will take notes on that.

2 Likes