Add ammo system to Weapons Kit

  1. What do you want to achieve?
    (I am a new writer program)
    I want to add an ammo system to the Weapons Kit provided by Roblox
  2. What is the issue?
    I am designing a survival game and I need to have an ammo system in my game
    Because when the player picks up the gun, he must also have a special ammo for that gun to fire and reload the gun.
    But the Weapons Kit provided by Roblox are unlimited weapon ammo
    I want to add an ammo system to the Weapons Kit provided by Roblox
    I do not know if this is possible or not
    (I want to use the Weapons Kit because it was designed very professionally)
    Weapons Kit:
    Weapons Kit | Roblox Creator Documentation
  3. What solutions have you tried so far?
    I went through all the scripts of the guns and even made some changes, but when I tested them, the ammo was still infinite.
5 Likes

Like the weapons kit says.

AmmoCapacity (IntValue) (optional) —

“Number of shots in each “ammo clip” before player must reload; default is 30. Note that ammo is unlimited and this does not specify how much ammo a player is carrying.”

2 Likes

Can infinite ammo be removed?
And the gun takes its ammo from the player backpack?

1 Like

Mhm. It would take a few scripts though.

2 Likes

There is a limited ammo capacity in the roblox weapon’s kit already. I dont understand, how is there unlimited ammo?

2 Likes

There is unlimited ammo, according to the author.

2 Likes

(I use a pistol). When the pistol has run out of 10 ammo, it reloads and returns 10 ammo. I want to reload if there was ammo player in the backpack

2 Likes

Oh i get what you mean now. Ill see if i can help you in some time,

3 Likes

It’s not that hard, you can use

tool.Equipped

for the ammo.

2 Likes

its not quite simple making a limited ammo system when it comes to the Roblox Weapons Kit

4 Likes

Follow the roblox weapons kit scripts like I’ve shown above.

2 Likes

Thanks for your help, I will follow it and announce the latest news here

I have finally made a proper ammo system (but not a full system) for the Pistol (that you specified) in the Roblox Weapons Kit. This took a lot of my time, but hopefully this really helps.

Please do the following instructions below for your ammo system:

Insert 2 IntValues inside of your (specified) Pistol tool, and rename them to CurrentAmmo and LimitedAmmo. Change the LimitedAmmo value to how much ammo the Pistol will have (like 20 full ammo).
(You can apply this to any other gun btw, just change the LimitedAmmo value and clipSize to whatever you want.)
Keep in mind that this system will only apply once the ammo of the Pistol reaches 0. I tried making it when a player presses R to reload when the gun hasnt reached 0 yet, it will subtract the ammo still. But unfortunately, it was just bugging instead. I will try to finish the full Ammo System tomorrow afternoon (EST).
Hopefully this helps at least

8 Likes

Thanks for your help
I tried this code and it really helped me a lot
answered !!!
Only one question remains
How do I connect this to the Inventory (backpack)?
And if the player has ammunition for the pistol (or any other weapon), reload the weapon
For example, I found a gun but I do not have ammunition for it and I can not shoot, but later I found 2 bullets (or several) and I can only shoot twice.

3 Likes

What do you mean by this, like how the gun is going to go in the backpack when they touch the gun or something?

Is this a bug, or are you just stating how it works for you?

3 Likes

My game is supposed to be like Dayz, The Forest and a bit like Battle Royale
I mean, if ammo is found in the backpack, the gun will reload
In Dayz and The Forest games, you have to find weapons and ammo separately

No bugs
I just gave an example that my game is supposed to be like this ( ammo must be found in different places in the game)

2 Likes

Well that’d be a very complicated process especially when it comes to the Roblox Weapons Kit.

Maybe you can make ammo drops instead, like you know the game Arsenal, when someone dies, ammo box drops, and when you touch the ammo box, your LimitedAmmo value would increase.

Thats just an example, its all up to you, but i would highly suggest ammo boxes, since thats a better and very less complicated process.

2 Likes

So do you think I should design a new weapon or modify the Roblox Weapons Kit? (Whichever is easier)

So how do I make this?

2 Likes

Im pretty busy right now, so i am not able to help yet. In an hour or so, i am able to help.

3 Likes

OK no problem
Thanks for the code you sent above
It helped me a lot

2 Likes