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
Any help would be greatly appreciated!

6 comments
Use the Changed event
Ohh, okay. Let me try it!
@Pupppy44, doesn't work
You probably didn't do it correctly then
Can you please write an answer on this?
IntValue.Changed:Connect(function(Value) if Value < 1 then something() end end)