When I deal with muzzle flare, I usually keep the muzzle flaring until the player stops holding down the mouse. But, the muzzle flare keeps going when the gun is not firing and is all out of ammo and the player is still holding down the mouse. I prevent this by having a wait loop that runs every millisecond or something.
The problem is, wait loops can take up a lot of memory and I want to look for a more efficient way of checking ammo. Here’s my code:
while wait() do
if PrimaryCurrentAmmo < 1 then
--//Code here
end
end
I’d suppose that you could use a Boolean to detect if there is ammo in the gun. I’m not sure if this would work well or at all but I think that you can give it a shot (pun intended).