Designing an FPS Framework: Beginner's guide

Thanks for the help! :slight_smile:

Do you think you will ever make a continued version on how to make switching weapons possible? Or could explain how it is possible? I think a lot of people would enjoy this.

i dont think i will be making another part for that, although:

Alright, I think I found a decent way to do switching weapons using what you said.

Basically what I did to start was adding a folder for GunValues inside the gun

Next I added values such as damage, fire rate, ammo etc.
But more importantly a string value named Key.
The Key would be, One Two or Three… etc.

Basically if input was detected it would check if you pressed any number key corresponding to the gun’s key, if so I made a function in the module to unequip a weapon (basically doing the opposite of equip function)

Then everywhere In the code where it contained damage values, recoil, ammo etc. I changed those to be equivalent to values inside your current equipped gun (held in a variable)

So far for me it works pretty well

If you want me to go more in depth I can.

3 Likes


Why is this happening?

I tried changing some stuff like unanchoring the humanoid root parts and etc but nothing seems to be working

May be issues regarding the welding of the gun components and the gun rigs itself. Make sure they’re welded properly.

I sorta fixed the issue by putting a motor6d in the muzzle part and connecting it to the front part

Hey there! So I used this tutorial to help me make a melee weapon system in FPS style.

Things turned out really well for it, I was able to weld the model and the weapon together, and it’s on my screen exactly where it should be. The only thing I couldn’t figure out is how to make the weapon and arms visible to other people. When I zoom out and look at my character, he doesn’t have the fps arms or a gun. As you’re probably expecting, the fps arms and gun are still visible on my camera when I zoom out. I have looked tirelessly to find a tutorial on how to make my arms visible on my character when I use the server-sided view. Are you familiar with: “Decaying Winter”? I’m trying to make my camera and view model replicate to the server, so that other players can see me holding my weapon, just like in Decaying Winter. Do you think you could help me, or rather refer me to a guide that explains how to do this? I would greatly appreciate it!

Hey, so actually to replicate weapons, you’d need 2 different weapon models and animations, 1 for client and 1 for server. When the player equips a certain weapon it will weld and play the animation for the client and the server will also weld and play the server animation.

As example, you can see the client viewmodel doesn’t replicate to other players
(image is from client side)


An the server just clones the player’s setup and play a server side animation for everyone to see.
(image is from server side)
image

Same applies to any melee, grenades, anything basically. Hopefully that makes sense.

I fixed this issue by making an ObjectValue and setting the value to a fake gun inside of ReplicatedStorage

Then in the “serverHandler” I made a function for when the player joins to add a Motor6D to their Torso

Then in the module.equip(), i added 2 extra parameters which are called: “tool, toolIdle, character”,
Then I copied the welds that were used in module.equip(), and just replaced them with character variables.

Example:

local toolHandle = tool.Handle
local motor = character:WaitForChild("Torso").Motor6D
motor.Part0 = character:WaitForChild("Torso")
motor.Part1 = toolHandle

then you can just use that tactic for all the other stuff, like reload animations, fire animations, etc.

FORGOT TO MENTION: you have to assign “tool” by making a remote event showing the server the original weapon, then using clientEvents to return the object value for tool

This tutorial is really helpful. Great job man!

i dont know why but my barrel is for some reason underground even though i can see it attached to my gun and because of that bullets come from the underground

Are you sure it isn’t anchored?

the weld may be disabled for some reason
check again

How do I make the viewport animations play on the 3rd person character, saving me the time of re-doing the entire animation?

The viewport animations will probably won’t be the same as the 3rd person character animations. If you can’t be bothered with just reanimating the 3rd person arms, then IKControl is always an option.

2 Likes

Damn, so there’s no way to just copy the animation onto the actual arms…?

Well I’m assuming your viewmodel is different from your character arms, if they are the same then you will have no problem, but if it is not the same then it’s pretty difficult to migrate them.

1 Like

Awesome tutorial. Viewmodels have long since mystified me but not anymore thanks to you :​)

1 Like

How to handle viewmodel when the player dies? My viewmodel just stays wherever the player dies

already answered in the discord server(?)