TomsGames
|
  |
| Joined: 11 Oct 2013 |
| Total Posts: 1615 |
|
|
| 03 Mar 2014 08:29 AM |
Right, I'm new to data stores and so I have a few questions the wiki page didn't quite answer or explain well enough.
There is a method which is "GetDataStore(name, scope)".
The name variable, must this have been set beforehand? If so how?
I mean, if I used GetDataStore("Test1") in one game, would this create a whole new data store for me called Test1?
If I went to another place could I access the Test1 datastore?
To make a new key within this datastore, would I use "SetAsync("ptz", 5)" to set the key "ptz" to the value of 5? |
|
|
| Report Abuse |
|
|
Bebee2
|
  |
| Joined: 17 May 2009 |
| Total Posts: 3985 |
|
|
| 03 Mar 2014 08:32 AM |
No. Technically no. If it's the same place... I think. That's why I use global data store to save game to game. Yes. |
|
|
| Report Abuse |
|
|
TomsGames
|
  |
| Joined: 11 Oct 2013 |
| Total Posts: 1615 |
|
|
| 03 Mar 2014 08:32 AM |
| In short, how do I SET UP a data store for myself and how do I set up keys inside? |
|
|
| Report Abuse |
|
|
TomsGames
|
  |
| Joined: 11 Oct 2013 |
| Total Posts: 1615 |
|
|
| 03 Mar 2014 08:35 AM |
Ok so using game:GetService("DataStoreService"):GetDataStore("ContinuePressed") will load the ContinuePressed data store. If it doesn't exist, it will create one. Right? :S
So if I made that in Traffic Runner, could I then create another place and edit the data store in traffic runner through the second place?
How would I use SetAsync for the first time? So if someone joined I check if the key already exists, how would I go about doing that? |
|
|
| Report Abuse |
|
|
Bebee2
|
  |
| Joined: 17 May 2009 |
| Total Posts: 3985 |
|
|
| 03 Mar 2014 08:39 AM |
I suggest
:GetGlobalDatastore()
If you want to edit game through game. |
|
|
| Report Abuse |
|
|
Bebee2
|
  |
| Joined: 17 May 2009 |
| Total Posts: 3985 |
|
|
| 03 Mar 2014 08:40 AM |
| Just check if the value of their set data store exists or not. |
|
|
| Report Abuse |
|
|
TomsGames
|
  |
| Joined: 11 Oct 2013 |
| Total Posts: 1615 |
|
|
| 03 Mar 2014 10:00 AM |
Is a key a child of a datastore?
So..
If game:GetService("DataStoreService"):GetDataStore("Test1").ptz ~= nil then |
|
|
| Report Abuse |
|
|
Bebee2
|
  |
| Joined: 17 May 2009 |
| Total Posts: 3985 |
|
|
| 03 Mar 2014 10:03 AM |
| No, it's more of a website-like thing. |
|
|
| Report Abuse |
|
|
TomsGames
|
  |
| Joined: 11 Oct 2013 |
| Total Posts: 1615 |
|
|
| 03 Mar 2014 10:04 AM |
.-.
So how do I check it's it exists? |
|
|
| Report Abuse |
|
|
Bebee2
|
  |
| Joined: 17 May 2009 |
| Total Posts: 3985 |
|
|
| 03 Mar 2014 10:06 AM |
When you get the asyc inside, it should return nil.
|
|
|
| Report Abuse |
|
|