Help with using tables

I am trying to save the data in a folder and the way I’m doing it by saving the content of the folder into a table, placing the table in a DataStore.

But I can’t figure out how to get the data from the table and place it back in the folder.

The data would look like this:

plr.Avitar.THENAME

The Data are string values if that changes anything.

Heres my converting to a table and saving it.

local skinTable = {}
	
for i, v in pairs(plr.Avitars:GetChildren()) do
	table.insert(skinTable, v)
end
	
skinData:SetAsync(plr.UserId, skinTable)

Can Anyone Help?

Is the Folder in Workspace? Or inside the Player?

The Folder is inside the player

I suggest you view this:

if it is what your trying to do.

No, Im trying to create the String Values again and give them the of the data

You could use:
(Although I am not sure)

table.remove(skinTable, v)

Hope it helps.

This wasn’t it but I did figure it out anyway. Thanks anyway!

hi ! sorry for bothering but what was the solution? could you elaborate or give me a small idea what you did to the table? thx

So what I did was I looped through the table in a for loop, then I created a new Instance in the folder and gave it the value of the value in the loop.

if skinData ~= nil then
	local data = skinData:GetAsync(plr.UserId)
	for i,v in pairs(data) do
		local s = Instance.new("StringValue", plr.Avitars)
		s.Name = "Skin"
		s.Value = v
	end
end

This was my code.

skinData is the dataStore, so just name it anything and set it up like this.

local skinData = game:GetService("DataStoreService"):GetDataStore("SkinDataStore")
1 Like