I want to make a bolt action gun system where if player fires a couple of rounds they puts a new clip in loads the amount that’s missing then discard the remaining clip instead of loading individual rounds to encourage on saving ammunitions
(Like this:)
Problem is I don’t know how would I go about doing that. The ‘make loaded bullets invisible’ part I mean.
What I really want is that it plays animation of the player loading the gun with a stripper clip really fast (it’s obviously an illusion so that I don’t have to make billion animations for them) so if the gun is missing 3 bullets the bullet number 1 and 2 will be visible. How would I do that? cause I don’t want to do a long elseif lines of
if bulletneeded == 3 then
bullet5.transparency == 1 and bullet2.transparency == 1 and bullet3.transparency == 1
elseif
---blah blah blah
It’d also be useful for a belt fed machine gun in the future
There are different solutions to the same problem, but one that I have in mind would be using for i = x, y do loop.
I start off by naming the bullets like _bullet1, _bullet2, and so on, all in order.
You start by naming the last bullet _bullet1 and go on all way to the first bullet to give an impression that the bullets are going toward the chamber if you get my idea.
Then with the loop, you will make it start from 1 and end by the amount of missing bullets, like this:
for i = 1, MissingAmmo do
Mag["_bullet"..i].Transparency = 1
end
Well obviously I’m not going to have 100 physical bullets, if it’s a long belt and not an ammo pouch I will probably use a texture or something similar instead and just shorten the size as the players shoot them