|
| 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
|
  |
| Joined: 07 Oct 2015 |
| Total Posts: 1001 |
|
|
| 16 May 2017 01:57 PM |
use a scope and UpdateAsync
|
|
|
| Report Abuse |
|
|
| |
|
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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
| |
|
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
|
  |
| Joined: 17 Dec 2014 |
| Total Posts: 627 |
|
|
| 16 May 2017 02:21 PM |
| your tables at all as long as * |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
| |
|