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
 

Use datastore as a record keeper

Previous Thread :: Next Thread 
KingAndrewofStuart is not online. KingAndrewofStuart
Joined: 31 Oct 2013
Total Posts: 2183
16 May 2017 01:54 PM
I want to use datastore to keep different tables for players, but I want all the tables to be saved, even when you leave a server and join another one.

For example, I enter a game and a new table called tbl1 is saved to me in datastore.

2 days later, I play again and another table called tbl2 is saved to me.

How would you format this to also retrieve the info?


Report Abuse
Baseness is not online. Baseness
Joined: 07 Oct 2015
Total Posts: 1001
16 May 2017 01:57 PM
use a scope and UpdateAsync


Report Abuse
KingAndrewofStuart is not online. KingAndrewofStuart
Joined: 31 Oct 2013
Total Posts: 2183
16 May 2017 01:58 PM
How would that look like?


Report Abuse
DevJoas is not online. DevJoas
Joined: 17 Dec 2014
Total Posts: 627
16 May 2017 01:58 PM
Have you heard of roblox wiki?

It's a great place

wiki.roblox.com/index.php?title=Saving_Player_Data

wiki.roblox.com/index.php?title=Data_store
Report Abuse
KingAndrewofStuart is not online. KingAndrewofStuart
Joined: 31 Oct 2013
Total Posts: 2183
16 May 2017 01:59 PM
Yes I have,

Now can you help, because I dont want the previous values to go away?

Thanks


Report Abuse
RogueMage is not online. RogueMage
Joined: 28 Jan 2012
Total Posts: 1235
16 May 2017 02:03 PM
Did you just ignore those two perfectly useful links he gave you
Report Abuse
DevJoas is not online. DevJoas
Joined: 17 Dec 2014
Total Posts: 627
16 May 2017 02:03 PM
Have you read those articles?

Have you read them completely?
Report Abuse
KingAndrewofStuart is not online. KingAndrewofStuart
Joined: 31 Oct 2013
Total Posts: 2183
16 May 2017 02:06 PM
That one only has variables that change and can be updated, and I understand how to do that.

What I'm asking is how do I make a data store that has different tables, and how can I add it to the table.

I'm not doing something with money or experience, and they aren't even numbers


Report Abuse
RogueMage is not online. RogueMage
Joined: 28 Jan 2012
Total Posts: 1235
16 May 2017 02:09 PM
wiki.roblox.com/?title=Table

wiki.roblox.com/index.php?title=API:Class/HttpService/JSONEncode -- to save it to the datastore (which is done automatically)

JSONEncode turns a table into a string so you can save it to a datastore ez

JSONDecode takes that JSONEncoded table and turns it into an actual table you can read from

wiki.roblox.com/index.php?title=API:Class/HttpService/JSONDecode

Tadah...

Now all you need to do is know how to manage and read from tables properly
Report Abuse
DevJoas is not online. DevJoas
Joined: 17 Dec 2014
Total Posts: 627
16 May 2017 02:13 PM
Keep one value for how many times the player has joined and make a value like

UserId .. "|" .. timesJoined

For every time he joins then you can get them back?
Report Abuse
KingAndrewofStuart is not online. KingAndrewofStuart
Joined: 31 Oct 2013
Total Posts: 2183
16 May 2017 02:14 PM
good thing i know how to do that

thanks

doesnt it encode and decode automatically, or do you need to manually do it?


Report Abuse
RogueMage is not online. RogueMage
Joined: 28 Jan 2012
Total Posts: 1235
16 May 2017 02:15 PM
Encode is done automatically when you SetAsync or UpdateAsync (Not sure about update) to Datastores

Decode has to be done manually
Report Abuse
Gomlsauresrex is not online. Gomlsauresrex
Joined: 25 Mar 2016
Total Posts: 3588
16 May 2017 02:17 PM
Automatically.

JSONEncode turns lua code into a JSON code format while JSONDecode turns JSON code into a lua code format.
Report Abuse
DevJoas is not online. DevJoas
Joined: 17 Dec 2014
Total Posts: 627
16 May 2017 02:17 PM
You don't have to decode or encode your tables as long as they have ONLY numbers as keys or ONLY strings as keys
Report Abuse
Gomlsauresrex is not online. Gomlsauresrex
Joined: 25 Mar 2016
Total Posts: 3588
16 May 2017 02:18 PM
Manually, is what I mean.
Report Abuse
DevJoas is not online. DevJoas
Joined: 17 Dec 2014
Total Posts: 627
16 May 2017 02:21 PM
Again, You don't have to manually decode or encode or change your tables at all your tables as long as they have ONLY numbers as keys or ONLY strings as keys
Report Abuse
DevJoas is not online. DevJoas
Joined: 17 Dec 2014
Total Posts: 627
16 May 2017 02:21 PM
your tables at all as long as *
Report Abuse
KingAndrewofStuart is not online. KingAndrewofStuart
Joined: 31 Oct 2013
Total Posts: 2183
16 May 2017 02:30 PM
What I did was make 2 tables and group them into one master table. Then I saved that table to a person's userid in datastore. To retrieve it, i got the master table, but how would I break that up into the 2 separate tables (these are dictionary tables)?


Report Abuse
KingAndrewofStuart is not online. KingAndrewofStuart
Joined: 31 Oct 2013
Total Posts: 2183
16 May 2017 02:31 PM
nvm, figured it out


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