Trying to get a specific value from a players data, I’ve accessed the player data using GetAsync but I Icant get a specific value out of it.
This is a picture of the datasave script showing that I used tables.
How would I get my desired value out of the table, it keeps returning as nil.
If I were you, I would give your data a string index.
So instead of using dataToSave[i], try using dataToSave[v.Name] which will create an index with the folder’s name. Then when you are ready to index your data, you can do dataToSave['myDataIndex']. This way, it stays the same and you’re able to index it the same way each time.
for i, folders in pairs(folder:GetChildren()) do
dataToSave[folders.Name] = {}
for j,data in pairs(folders:GetChildren()) do
dataToSave[folders.Name][data.Name] = data.Value
end
end
Thanks! I think I see the issue, hold on.
So, you’d have to try something like this:
for i,folder in pairs(Storage:GetChildren()) do
local dataFolder = Instance.new('Folder', PlrStats)
dataFolder.Name = folder.Name
for j,value in pairs(folder:GetChildren()) do
local dataValue = Instance.new('IntValue', folder)
dataValue.Name = Value.Name
dataValue.Value = saves[i][value.Name] -- indexes your saved data with the name of the value inside of your folder inside of storage. 'i' is your folder's name, and 'j' is the specific value's name.
end
end
Gives the same error, Its trying to get the health value from something that doesn’t exist, I’ll try to use what you said to fix the old Datasave script to see if that works.