How can I save values in a folder?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to be able to save the values in a folder, for example: a folder named pets, with multiple string values, each string value has a name which is different pets names, like rainbow cat, windy cat, etc. and the values value is either “Owned” or “Not Owned”. So basically you can buy pets in a shop and then once u buy pets in a shop it changes the pets value in the folder to owned because you bought it, and then i want, when the player leaves the game, that value to save, if you own the pet or not.

  2. What is the issue? Include screenshots / videos if possible!
    I have tried devforum, yt nothing. Nothing works

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub? Yes, but i wasn’t successful.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

I have some code but its not useful, i wanna start over.

Could you paste your code even though you might not find it useful? We could use it to understand how your game is structured so we know how to complete the saving system for you.

1 Like
local folderThatHasValues = -- path to folder
local DataStoreService = game:GetService("DataStoreService")
local DataStore = DataStoreService:GetDataStore("FolderValues")
local key = "myKey_69420"
local savingValues = {}

for i,v in pairs(folderThatHasValues:GetChildren())do
  table.insert(savingValues, v.Value)
end

DataStore:SetAsync(key, savingValues)

This is an example!

1 Like