How do i code a decent gun?

Hey, i was wondering one of the most generic things on game development history: How to make a gun.

I have tried coding with guns before but most of the times were very glitchy or didn’t even work at all.

So now i am looking for a decent tutorial on how to make a decent gun, if someone could link me youtube videos, maybe devforum / devhub posts. I have already looked some videos on youtube but they weren’t very good or didn’t teach how to make an actual good gun.

My definition of a decent gun is to have:

  • Shooting Flare / beam where the bullet hits
  • Fire and reload system with ammo (Unlimited ammo but having to reload)
  • Shoot Animation
  • Bullets ui
  • Easy customization, to easily change damage, ammo, bullet speed, etc

Seems like a lot bot if you look into it, it’s what every good gun needs.

All help is appreciated, thanks.

Here you go.
How to make a gun devforum.roblox.com - Bing
How to make a gun in Roblox - Bing

1 Like

Based on the question I assume you aren’t familiar with event based programming, so I would start there. After you understand that, then go take a look at how RayCasting works, as you will likely want to use that method.

2 Likes

It’s a funny thing to be honest, i’m fine with a good part of programming but i do have complications on things that i shouldn’t. Guns for example are something i have been wanting to learn for a long time and haven’t really looked into it.

I did see a raycast tutorial from TheDevKing and i wanted to take a look at it for a while too.