drgn42
|
  |
| Joined: 11 Feb 2010 |
| Total Posts: 3231 |
|
|
| 17 Feb 2016 08:13 PM |
So I used
local Stats = DataStore:GetAsync("StatsToSave")
to get the stats for my game. StatsToSave is a dictionary I stored earlier, and now I'm trying to use
for key,value in pairs(Stats:GetChildren()) do
and it's saying that GetChildren is nil. So I don't know what's happening, but it's almost like my dictionary isn't being loaded like a dictionary. Any help?
Exact output: attempt to call method 'GetChildren' (a nil value)
Because of that output, I feel like it's loading as a string more than anything. |
|
|
| Report Abuse |
|
|
DataStore
|
  |
| Joined: 07 Feb 2012 |
| Total Posts: 8540 |
|
|
| 17 Feb 2016 08:22 PM |
I don't quite get why you're using GetChildren - GetChildren is a method which is used to get an array of the given object's children. You cannot store objects directly into a DataStore, so therefore there's no reason for you to be using this.
To iterate through a table you would simply do what you're doing, but drop the whole 'GetChildren' usage. |
|
|
| Report Abuse |
|
|
drgn42
|
  |
| Joined: 11 Feb 2010 |
| Total Posts: 3231 |
|
|
| 17 Feb 2016 08:26 PM |
So I could just do this?
for key,value in pairs(Stats) do
Some reason I was lead to assume that tables had children that needed iteration. But I guess it makes sense that I'd just have to put in the name of the table used. I don't know why I thought that. Thanks for the help. |
|
|
| Report Abuse |
|
|