# Anyone know how make a save mechanic?

**URL:** <https://forum.makecode.com/t/anyone-know-how-make-a-save-mechanic/29650>\
**Category:** Arcade\
**Created:** [July 11, 2024, 2:36am UTC](https://forum.makecode.com/t/anyone-know-how-make-a-save-mechanic/29650 "2024-07-11T02:36:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![goldtopaz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/goldtopaz/32/28622_2.png) [@goldtopaz](https://forum.makecode.com/u/goldtopaz)\
**Post date:** [July 11, 2024, 2:36am UTC](https://forum.makecode.com/t/anyone-know-how-make-a-save-mechanic/29650/1 "2024-07-11T02:36:48Z")

</div>

a save mechanic like when you turn off the game you would be in the last place you were in the game or something like that so you could save progress. if you know how to make one of these can you show me a piece of code that makes that happen?

---

<div class="post-metadata">

**Author:** ![Luke](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/luke/32/32519_2.png) [@Luke](https://forum.makecode.com/u/Luke)\
**Post date:** [July 11, 2024, 5:19pm UTC](https://forum.makecode.com/t/anyone-know-how-make-a-save-mechanic/29650/2 "2024-07-11T17:19:09Z")

</div>

Just save the players x and y with settings blocks

---

<div class="post-metadata">

**Author:** ![MYR](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/myr/32/16320_2.png) [@MYR](https://forum.makecode.com/u/MYR)\
**Post date:** [July 11, 2024, 5:20pm UTC](https://forum.makecode.com/t/anyone-know-how-make-a-save-mechanic/29650/3 "2024-07-11T17:20:34Z")

</div>

Yes! There is an extension in makecode library called ‘Settings Blocks’. There are more in-depth versions elsewhere, but only this is necessary for most things. Basically, the blocks keep track of numbers or number arrays forever, even if the script is stopped and then run again, or refreshed! You can of course, delete all data too. There is also a handy ‘if data of name “” exists’ block to set all variables to 0 if you haven’t played before. Example:

 ![Screenshot 2024-07-11 8.28.07 AM](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/4/6/46f6987174b7e8de32dd9e014addf9b9b81353d5.png)

---

<div class="post-metadata">

**Author:** ![Rune](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/rune/32/18951_2.png) [@Rune](https://forum.makecode.com/u/Rune)\
**Post date:** [July 11, 2024, 5:21pm UTC](https://forum.makecode.com/t/anyone-know-how-make-a-save-mechanic/29650/4 "2024-07-11T17:21:15Z")

</div>

I believe [this](https://forum.makecode.com/t/extension-bettersettings-save-booleans-images-and-string-arrays/19089) is what you need. It is an improved version of the settings extension that allows you to save more than just numbers.
