Hello, I am very interested in making a gun for my game. To be honest I haven’t come across any good tutorials on making guns (Third Person). They mostly just skim over on what they are doing then present the end result.
Also take note that I’m talking about a Third Person Shooter, not First Person. There are good FPS tutorials but I’m looking to make a Third Person Shooter System.
I was thinking of making a gun very similar to the one in the reference video.
I’ve been doing code a a decent amount of time but I have no idea where to start when it comes to scripting the gun(I can build it). I’d really appreciate if someone could help me out on where to start and shoot me some good tutorials or what ever is out there.
The reason most tutorials just “skim” over what they’re doing is because it’s tedious to explain every actual step in the process.
Making a “good” gun takes a lot of scripting knowledge. If you’re not already somewhat advanced, I highly suggest making a simpler gun first.
Since the question is for a “good” gun, then:
First you’ll need a working TPS camera system. Either you just force Shift-Lock on everyone, or you need to know how to manipulate CFrames and update it every time the mouse moves - you might also need to adapt to whatever device the player’s using like mobile or console if you plan to include those. Bonus work if you want fancy stuff like view bobbing, sway, etc.
Next is player input and state management for both the character and the gun. When the player presses the fire button (input), you need to first check if they can do that based on:
Is the player currently sprinting?
Is the gun currently being reloaded?
Does the gun have at least one bullet ready to fire?
Then you fire the gun:
Get the direction of aim
Add some spread to that
Fire the bullet
Play firing animation
Play sounds
Play VFX
Update ammo remaining
Update any state changes (stop sprinting, stop aiming down sights, etc)
Then you handle the hits:
Apply hit effects depending on what’s hit
Verify hit validity using server-sided checks
Deal damage if a valid target was found
You also need to handle reloading, automatic weapons that just keep firing, shotguns, etc.
I personally feel that the amount of knowledge required to make proper guns is highly underestimated, a lot of people focus on the visuals and effects. I’m not downplaying the amount of work for that either, but there’s a reason pre-made weapon frameworks already exist - it’s a lot of work if you want a decent one.
Honestly I find that hard to answer, the simplest I’ve ever “made” a gun was taking one from free models and lightly editing it at least that’s where I started, it would help you understand how these systems work. Apologies if I caused you to be intimidated with gun systems. It sounds complicated, and in a way, it is, but it’s just because of the amount of moving parts so to speak. Once you understand how the whole thing works, every step is actually pretty simple.
This would be the literal “simplest” gun tutorial I’ve found, it’s just a point and click gun.
Here you begin to add some effects, at least for this tutorial it was just muzzle flash.
Going further, this tutorial shows animations being played. You’re now being introduced to states, and how you should handle each “state” - like carrying, shooting, etc.
Beyond that, you might notice that those guns don’t really have bullet travel time or bullet drop, or actual bullets at all. From this point I’d recommend anything about guns from B Ricey, starting from here. He goes more in depth about other gun-related stuff, and if you’re confused about anything he does (like OOP) he has tutorials for that too.