Data saving, how do you do it?

Lord Farquad
Joined 08/04/2021
Posts 6
08:58 PM 13/04/2021
So I'm trying to make an obby that saves your progress (it's a long obby, and I want it to save your spot if you leave). How would I do this (I'm a beginner at scripting, so anything would be helpful). Thanks


SmartLion
Joined 16/04/2017
Posts 1,970
05:43 AM 14/04/2021
You can do this by using any node modules that save to the filesystem either directly or to a database file.
I would recommend using flat-file-db to begin with
https://www.npmjs.com/package/flat-file-db
Then whitelist the module by editing your start.js.
You can now use the module in a script!
Because node-hill uses vm2 to execute scripts, you can't just do require("your-module") but instead you do getModule("your-module") to get a module.
It is then entirely up to you how you want to save the data in the key value database.


Lord Farquad
Joined 08/04/2021
Posts 6
11:55 AM 14/04/2021
Quote from SmartLion , 05:43 AM 14/04/2021
You can do this by using any node modules that save to the filesystem either directly or to a database file.
I would recommend using flat-file-db to begin with
https://www.npmjs.com/package/flat-file-db
Then whitelist the module by editing your start.js.
You can now use the module in a script!
Because node-hill uses vm2 to execute scripts, you can't just do require("your-module") but instead you do getModule("your-module") to get a module.
It is then entirely up to you how you want to save the data in the key value database.
Thanks! Will be trying in the next few days to implement this.

1