Quick and easy question, i have a shop with trails, and pets, how would i save the trails, and pets bought, so no player has to restart on buying everything again?
COMMUNITY QUESTION
how to save shop items bought?
1 answer
To start, you need to learn DataStore, or be lazy and get spoonfed by pre-made code.
There is a good & simple method to save it, here's an a practical explanation:
Before starting,
- Store all of the tools / items in a folder where a script can access.
When the player leaves
Check if they have any tools in their backpack,
If they do have tools / items then, (
ifstatement)- Store the tools' / items' name that are in their backpack into a datastore. (
Table)
- Store the tools' / items' name that are in their backpack into a datastore. (
If they don't have tools / items then, (
ifstatement)- Store
nilor nothing in the datastore. (nil)
- Store
When the player joins back
Check if they have any tools / items saved in the datastore,
If they do have tools / items in the data store then: (
ifstatement)Look into the folder where all the tools / items are stored, (
pairs())- Restore the tools / items back into their backpack. (
:Clone())
- Restore the tools / items back into their backpack. (
If they don't have tools / items in the data store then: (
ifstatement)- Don't do anything.
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Use DataStoreService.
^ And OP, refrain from posting requests.