generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Dictionary In Data Store Not Loading

Previous Thread :: Next Thread 
drgn42 is not online. 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 is not online. 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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image