How can I begin working on a gun system?

I want to create a 1st Person/3rd person gun system. I want it to be like Arsenal and Weaponry combined. I want it to have mobile and controller support.

The thing is I don’t know where to start learning about this. I want to use tools (like the ones you put in starterpack) and most beginner tutorials don’t use tools they just use viewports that pop up.

I want to know exactly what I need to learn to create a system like this, I know the basics of roblox like remote-events, properties, the difference between 3 types of scripts, etc and that’s why I want to create this project because I feel like I know most of the basic skills. Can somebody give me a roadmap on how to begin learning something like this. (now I know the basics but I do not know the basics of things like O.O.P and Datastores and other stuff like that and if that’s apart of the roadmap I’ll learn it as well)

In computer programming, there’s two terms called Decomposition and Abstraction. Decomposition refers to breaking down a large problem into smaller problems that are then solved and put together to solve the original problem. Abstraction refers to ignoring the unnecessary details of a problem.

In your case, you want to create a gun system. What sort of details do you not need to know when creating a gun system? Perhaps…

  • The colour of the gun
  • What timezone the player is in
  • Is the player winning in the game

Abstraction can depend on what you’re creating and what sort of details the system will be interacting with. For example, you could argue that whether a player is winning in the game or not is an invalid example of abstraction because the gun system you are trying to make will revolve around the player either winning or losing.

If you want to create a gun system, you need to understand what kind of mechanics your guns will have. Will your gun have a…

  • Reload system
  • Firing system
  • Equip/unequip system

Then, you can break those small problems into even smaller problems…

  • Reload system - animations for reloading, ammo count and replenishing that ammo count
  • Firing system - muzzle flash, bullets being fired, recoil
  • Equip/unequip system - animations for equipping and unequipping

You could even break those tiny problems into even smaller problems, and the cycle continues until you have problems that you can solve bit by bit. The general idea of using decomposition is to relieve stress of creating a system that has so many components and things you have to consider all at once and to just focus on one singular detail until you eventually create the entire system. I should also mention that abstraction comes very useful when decomposing a problem, as it’s no good to solve a problem if it’s irrelevant to the final system.

These two principles are so important in programming, understanding how to use these principles in combination with the fundamentals of programming (such as remote events, like you have stated) will determine whether you’re apart of the top most percentile of programmers or apart of the lower percentile of programmers. If you’re looking for a roadmap regarding how you should approach making a gun system, consider these two principles and create a roadmap of problems that you can solve, where each time you solve a problem, you go up the roadmap until you reach the end, where you have a fully functioning gun system!

I get that but I mean, people say you need to learn raycasting and other details to make a gun system and im wondering (in category of roblox knowledge) what you need to know

1 Like

Well, let’s use this as an example of decomposition. You want to solve the problem of making the bullets that are fired at a player do damage. You would first need to figure out a way to detect whether a bullet has hit something. A great method is ray casting. Therefore, you should research how ray casting works and how you can implement it into a detection system for the bullet. After which, you can then solve the problem of dealing damage to the player once a bullet has hit a player.

There’s so many different things that you need to know when creating a gun system or any system in general, that it will feel overwhelming which is why decomposition is used. It would be better to learn LuaU concepts one by one through solving decomposed problems than all at once, which is why I would recommend that you first map out in plain English what sort of thing you want to solve. Then, do a bit of research and find out how you can solve such a thing using programming, and finally, implement it and that’s it! Learning decomposition and abstraction can take time and practice, so mapping out a problem in plain English is a great way to learn these principles if you’re still learning the technical side of LuaU or any other programming language.

1 Like