Help with datasave

so i have a table that can be retrieved and saved but the contents of the table aren’t going in their respective values let alone finishing to iterate through the rest of the folder

Note the i value is the same with getasync and setasync, but other stuff are in other folders

if that messes it up is there anyway to fix this?

Have you tried to set it Parent?

What do you mean by that. I dont get it

You will have to set their .Parent for it. Like Part.Parent = workspace => Part will locate in workspace

uh, im using a table like {} but their indexed by the value i, im trying to set the “Saves” Folders values to the values in the table. I do not need to parent anything.

I don’t think you can store instances such as folders in to datastores. What is saved?

You would have to save the values of each value inside and then loop through the table of values and set the appropriate values.

a table is saved not folder, im just trying to get the values from the table and giving it to each number value and string value in the Save Folder. Note they need to go to the correct number value and string value. Saving a table also worked.

Alright then a misunderstanding, can I see the table that is printed when you load it?

It us a HUGE and i mean huge table, with 133 Values saved

while there is exactly 133 value instances as descendants in the Saves Folder

Wow that’s a big list ofc.

Maybe instead it would be best to index the table based on the name of that value then you can look through the indexes and find the value with the same name as the index like for example:

Let’s say I have a table with value wins and 132 values more for some reason.
Now to get specificly the wins in the corresponding spot you would save the table like so

local values = {
     [“wins”] = 5
     -- and so on lol

--Then loop through the table and find the corresponding value
local dataFolder = -- where you want the data to go
for name, value in pairs(values) do
     local instanceValue = dataFolder:FindFirstChild(name)
     if instanceValue then
          instanceValue.Value = value

Hope this makes sense maybe? :slight_smile:

It could work but i realised my problem was that it was counting the folders as values even tho i said

                           if not v:IsA("Folder") then

That actually makes sense since the folder is being counted as part of the index. Like your script is looping through lets say index 1, but that’s a folder so it will skip it…BUT there is actually data that there is on index 1 according to your magic table of 100+ values. So basically it will SKIP value 1.

I think that makes sense to me :D!

1 Like