How To Make A Gun

Yes, I have attempted to find the right posts for me but after searching the forum and google, I have found no posts or results that do specifically tell you how to make a gun.

I am a intermediate+ scripter and really want to learn how to make guns. I understand the fundamentals from this helpful reply from a year ago.

Anyways, I need some specific instructions on how I make the gun. I understand there are many tutorials on youtube for this, but none of them actually point you to making a advanced gun; I may be wrong, I haven’t thoroughly searched youtube, but am pretty sure, making this post I also do hope to help some people.

At the moment I just want to learn about how to do the specific functionality of the gun, the cosmetics of the actual gun model will not be much, probably just a few parts, just to learn the functionality for now. As for animations and effects, I will be handling it via module scripts which should be reasonably more easier.

By the way, might of already said this, please tell me if there is any posts that directly help me with this, I might not of found it, and I will accept fault for that. Thanks! :slight_smile:

EDIT: Will be checking replies soon :slight_smile:

3 Likes

Don’t ask for full scripts, it’s in the rules. This category is for help on already existing scripts, or just the general idea of how to make a script.

That is what OP is looking for. Make sure to read the main post.

As for your inquiry @OP, I think you should define what an “advanced” gun is.

2 Likes

player clicks left click > gun go pew pew > player lifts left click > gun stops go pew pew
every pew pew raycast from the player lookVector (which is a unit vector of the direction of the CFrame) * whatever distance you want your bullet to go. if bullet hit something and is human, do damage

2 Likes

It is pretty obvious I am not asking for a full script. I am asking for how to do it. The title is literally How to make a gun.

By advanced gun, I mean generally something that would be in production games such as phantom forces, arsenal, ro-nation games, etc.

My bad. I simply misunderstood the post.

3 Likes

I don’t know how we can help you with this. We don’t know what you mean by an “advanced gun”, what are its properties and features. Start off by making a simple gun from the tutorials you found, then expand it to contain more advanced features. If you meet problems or need help on making those advanced features, only then ask the devforum for help.

As for features;

  • Accurate aiming scope
  • As exploiter-proof as possible
  • Configurable gun stats (damage, fire rate, etc)
  • Ammo Gui
  • possibly attachments

I don’t have much experience in making FPS games, but I can help you with these:

My suggestion is that you use OOP for this. Each gun script contains an instance of a gun module, with the mentioned properties that can easily be tweaked. As for GUI, a LocalScript that communicates through the gun instance.

1 Like

You’re gonna want to use Raycasting. Assuming you’re trying to make an FPS, you’re going to want to center the mouse, and use a ray from the bullet location of your gun (in the barrel) to the mouse position. Then you’re gonna need a ViewModel. FPS games are really complex, so it’s kinda hard to explain everything. Sorry.

1 Like

Thats really helpful, thanks.

(only 30 characters)