Tripane
|
  |
| Joined: 03 Jun 2011 |
| Total Posts: 11432 |
|
|
| 01 Feb 2015 12:40 PM |
so I have a datastore that uses multiple strings
I am using a for loop to load the values of each particular string, is this incorrect? This method is loading all of the strings to the same value, so it's like
>one value is set to true, game saves it
>loads all of the values to that one value, so every single one is set to true
How should I go about saving multiple values under one datastore? And indexing that particular value based on the name? |
|
|
| Report Abuse |
|
|
Tripane
|
  |
| Joined: 03 Jun 2011 |
| Total Posts: 11432 |
|
|
| 01 Feb 2015 12:40 PM |
| Title should have been "loading multiple bools", I am dealing with bools |
|
|
| Report Abuse |
|
|
|
| 01 Feb 2015 12:44 PM |
| Values = {["Val1"]=true, ["Val2"]=false, ["Val3"]=false} |
|
|
| Report Abuse |
|
|
Tripane
|
  |
| Joined: 03 Jun 2011 |
| Total Posts: 11432 |
|
| |
|
Tripane
|
  |
| Joined: 03 Jun 2011 |
| Total Posts: 11432 |
|
| |
|
Tripane
|
  |
| Joined: 03 Jun 2011 |
| Total Posts: 11432 |
|
| |
|
Tripane
|
  |
| Joined: 03 Jun 2011 |
| Total Posts: 11432 |
|
| |
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
| |
|
Tripane
|
  |
| Joined: 03 Jun 2011 |
| Total Posts: 11432 |
|
|
| 02 Feb 2015 05:51 AM |
| but what do I do with the table in terms of the datastore |
|
|
| Report Abuse |
|
|
Tripane
|
  |
| Joined: 03 Jun 2011 |
| Total Posts: 11432 |
|
|
| 02 Feb 2015 06:06 AM |
| do you mean set a save in the datastore for each table member and then iterate through the table for every match found in the datestore? |
|
|
| Report Abuse |
|
|
Tripane
|
  |
| Joined: 03 Jun 2011 |
| Total Posts: 11432 |
|
| |
|
Tripane
|
  |
| Joined: 03 Jun 2011 |
| Total Posts: 11432 |
|
| |
|
Tripane
|
  |
| Joined: 03 Jun 2011 |
| Total Posts: 11432 |
|
| |
|
Tripane
|
  |
| Joined: 03 Jun 2011 |
| Total Posts: 11432 |
|
| |
|
daireb
|
  |
| Joined: 16 Nov 2012 |
| Total Posts: 726 |
|
|
| 02 Feb 2015 08:30 AM |
database = game:GetService("DataStoreService"):GetDataStore("MainStorage")
local strings = {var1="Hello",var2="World"}
database:SetAsync(strings, "Strings")
print(database:GetAsync("Strings")[var1].." "..database:GetAsync("Strings")[var2])
If you need books then just replace the strings with bools, easy! |
|
|
| Report Abuse |
|
|
Tripane
|
  |
| Joined: 03 Jun 2011 |
| Total Posts: 11432 |
|
|
| 02 Feb 2015 06:26 PM |
I don't understand the whole ("Strings") thing, it was never a variable?
How does this answer my question? Do I have to go through every member of the table? I can't loop through them? oooohhhh confusion |
|
|
| Report Abuse |
|
|
daireb
|
  |
| Joined: 16 Nov 2012 |
| Total Posts: 726 |
|
|
| 03 Feb 2015 03:37 AM |
When you set a Database, you need to give it an ID, which is the "Strings", it's like the name of a variable. Every data store entry needs a value (the table of strings) and an ID("Strings"), so you can access it again |
|
|
| Report Abuse |
|
|