Hello!
I’ve run into an issue with my datastores and using recursion. The problem is that I am creating a data verification system and I just cannot get it to work.
So, I have this template for default user data:
local defaultData = {
['Coins'] = 0;
['Wins'] = 0;
['Completed Obbies'] = 0;
['Inventory'] = {
['Accessories'] = {};
['Packages'] = {};
['Gear'] = {};
['Trails'] = {};
};
['Rank'] = 'AlphaTester';
}
When iterating through it, there are some nested tables. The problem arises when I get to the nested table. The data properly saves but when I try to verify, it just overwrites with a blank table.
function verifyData(tableToVerify, currentIteration)
local returnedTable = {}
for i,v in pairs(currentIteration) do
if tableToVerify[i] then
if typeof(v) == 'table' then
returnedTable[i] = verifyData(v, currentIteration[i])
else
returnedTable[i] = tableToVerify[i]
end
else
returnedTable[i] = v
end
end
return returnedTable
end
local dataFolder = Instance.new('Folder', player)
dataFolder.Name = 'PlayerData'
local newData = verifyData(data, defaultData)
Saving and loading the data both properly work, it’s just verification.
So the index of each iteration should be the value’s name, and the value should be the stringvalue’s value.

After rejoining:

The problem is that the values that are the direct children of PlayerData save, it’s just the children of the nested folders that don’t.
TIA for any help!