How to make reserve ammo not go in the negatives?

I used devscapes tutorial about ammo and reloading but now i have the issue that if i press r while my reserve ammo is 0, it still reloads 30 bullets in the mag and the reserve ammo goes to -30. And if my reserve ammo is a number like 27 it still loads 30 bullets in the mag and says that the reserve ammo is -3. How to fix this? its kinda annoying

I would go with 2 vars
One for ammo so let’s call it Ammo
And other for magazine so let’s call it Magazine

Ammo is how much you have in total
Magazine is how you have at the time loaded into your gun

In event where you reload you need to add condition
Ammo is greater than 30
In action you subtract 30 from Ammo and add 30 to Magazine

And another event with condition checking if Ammo is greater then 0
And another condition that Ammo is less than 30
In action set Magazine to Ammo and set Ammo to 0

So when you have 0 Ammo nothing should happen
Where you could add yet another event to idk flash red Ammo text or display some text saying NO AMMO when reloading

That is not your goal that is just to teach you the basics
Now you could play around with checking how much is in Magazine
For example 17
And subtracting only as much for Ammo as much can go into Magazine

For example

Condition
Magazine is less than 30
Ammo is greater than 30 - Magazine ← this will check if you have enough Ammo to fill fully Magazine

Action
Change Ammo subtract 30 - Magazine
Change Magazine add 30 - Magazine

Now if you have less Ammo than you can load into Magazine
For example you have 4 in Ammo but you can load more then that into Magazine

Condition
Magazine is less than 30
Ammo is Less than 30 - Magazine
Ammo is greater than 0

Action
Change Magazine set to Ammo
Change Ammo set to 0

Do not mix actions in any events cause order is crucial
For example
If you would set Ammo to 0
Then try to set Magazine to Ammo you would set Ammo to 0
That is why you 1st set Magazine to Ammo
Then Ammo to 0

thanks bro, this helped a lot