# Inventory/Storing

**URL:** <https://forum.makecode.com/t/inventory-storing/6776>\
**Category:** Help\
**Created:** [March 14, 2021, 9:30pm UTC](https://forum.makecode.com/t/inventory-storing/6776 "2021-03-14T21:30:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![brandodon](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/brandodon/32/3625_2.png) [@brandodon](https://forum.makecode.com/u/brandodon)\
**Post date:** [March 14, 2021, 9:30pm UTC](https://forum.makecode.com/t/inventory-storing/6776/1 "2021-03-14T21:30:33Z")

</div>

I need help making code so I can collect gas, and then when I go to a gasoline generator, it takes the gas out of my inventory and processes it as a function

Btw I main Java

> **[GeneratorNight](https://arcade.makecode.com/79962-87894-20845-21144)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

**Author:** ![DahbixLP](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/dahbixlp/32/4760_2.png) [@DahbixLP](https://forum.makecode.com/u/DahbixLP)\
**Post date:** [March 14, 2021, 11:19pm UTC](https://forum.makecode.com/t/inventory-storing/6776/2 "2021-03-14T23:19:25Z")

</div>

I have an idea!  
Make a variable of gas collected! So when you collect 1 gas you change the GasCollected variable by 1 (or make it so it is more) Then when you get to a generator you set the GasInGenerator to GasCollected and then set GasCollected to 0!  
Hope this helps!

---

<div class="post-metadata">

**Author:** ![brandodon](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/brandodon/32/3625_2.png) [@brandodon](https://forum.makecode.com/u/brandodon)\
**Post date:** [March 15, 2021, 4:14am UTC](https://forum.makecode.com/t/inventory-storing/6776/3 "2021-03-15T04:14:35Z")

</div>

I had that idea too! Instead of ‘GasCollected’ I had ‘AddGas’. But how do I change a variable value?

---

<div class="post-metadata">

**Author:** ![GameGod](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/gamegod/32/2756_2.png) [@GameGod](https://forum.makecode.com/u/GameGod)\
**Post date:** [March 15, 2021, 3:35pm UTC](https://forum.makecode.com/t/inventory-storing/6776/4 "2021-03-15T15:35:19Z")

</div>

`AddGas += 1`
