How would I go about saving a folder and all the contents inside of it?

Long story short the folder contains all the information needed to create an exact clone of a car, so car name, colors, stuff like that. Only one problem, I need to save it. How would I do this? Is there a way to get all the info in said folder and save that?

I have made the script that puts the folder inside of where I want it to be saved, I just need it to be saved. Is there a way to use a for loop to save it?

Where do you want to save it to?

Datastore, sorry for not clarifying

So what you wanna do is: create an array that will store all of the info inside the folder. For that you would create a table and a for loop:

local dataToSave = {}

for _, valueInstance in pairs(folder:GetChildren()) do
   dataToSave[valueInstance.Name] = valueInstance.Value
   -- the [] are the name of the value which I would make the name of the instance
end

After the for loop stores all information, the array would look something like this:

dataToSave = {
  ["Name"] = "Car",
  ["Color"] = Color3.fromRGB(255,0,0)
  --and stuff like that
}

And then you basically save the array to the datastore using :SetAsync(dataToSave).

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.