So currently I am making a gun, I am wondering if I should store my ammo in a number value or as a variable inside the script. What are the advantages and disadvantages of each one.
You should save it in a variable. The variable will store each function of the gun in which case will help it work properly. I would recommend doing the variable. The NumberValue will not be helpful, as it will only do certain objects for it.
With good anti-exploit measures (ammo is checked on the server as well), it doesn’t matter which you use. The advantage of value objects is that you can update your ammo in your GUI script without using modules (both the gun script and the GUI script can be regular LocalScripts), and they have events you can connect to to check when they change. Variables on the other hand are much faster and easier to deal with and will usually be the same value no matter where or when you index them. In your case I would recommend using variables as theres no real reason to add the bulk of a whole Instance when a single variable will do.
handling ammo on the server too, I didn’t think about that, it solves a lot of problems, this makes using variables a lot more plausible. I am keeping some values though since the server can force the client to update just to make it a little more annoying for hackers.