so this is my knife throw script, my bug is like when i throw a knife it go 29 and then when it regen to 35 or something when i throw again the value will become 28 and the value go to 0 when it regen i cant throw knife
if Player.Backpack.Value.Knife.Value >= 1 then
Player.Backpack.Value.Knife.Value = Player.Backpack.Value.Knife.Value - 1
The problem here most likely isn’t caused by these two lines of code. You’ll need to share more if you want to have a decent chance at being helped. Anyways, even though I don’t have enough information to help solve your problem with, one improvement and knowledge nugget I can impart unto you is the wisdom of compound operators. They were first introduced in this release notes.
Compound operators were made to help shorten your code. All of them have virtually the same syntax, and just do different operations. The list of available ones are: += , -= , *= , /= , %= , ^= and ..=. The syntax for these is value (operation)= other values. For example, here I use the += operator:
numValue += 1 --adds '1' to numValue
which is equivalent to:
numValue = numValue+1 --adds '1' to numValue
It’s the same thing with the other ones as well. numValue -= 1 is equal to numValue = numValue-1 and so on.
Anyways, we need more of your code to actually see what’s causing the problem.