BACKGROUND
So right now I am trying to make my DataStore more efficient, and to save some time from me having to insert every value into a table myself.
In order to save data in my game I make a dictionary then label the index and the value associated with it.
For Example:
local SaveFile = {
ShirtValue = CharacterSave.ShirtValue.Value ,
PantsValue = CharacterSave.PatsValue.Value
}
MemoryCard:SetAsync(Player.userId,SaveFile)
Then in order to retrieve the data I loop through the folder I saved everything in and apply the value for the specific name.
local save = Player:WaitForChild("CharacterSave"); --Folder with values
for i,v in next,PlayerData do -- PlayerData is the Datastore
save:WaitForChild(i).Value = v;
end
As you can see in the dictionary I have to add each value one by one in order to save each specific key for value.
Question Is there a way I can label the dictionary by looping through my charactersave folder?
Thanks for reading.

1 comment
Honestly man, you have saved my script so many lines, and for me; so much time. Thank you for this answer. So basically saying SaveFile[v.Name] changes the indexes name to whatever is in my folder's name.