|
| 17 Jan 2015 12:18 AM |
I was just wondering, is it possible to use Data Store to save a table when something is added/removed(changed) and to load it when the server starts?
Ex:
Playerlist = {"some1","some2","some3"}
How can I make this save when something is inserted(table.insert)/removed(table.remove) and load when the server starts? |
|
|
| Report Abuse |
|
|
| |
|
|
| 17 Jan 2015 12:45 AM |
I tried making a table.Changed event; failed.
I'd just recommend a loop with a large delay time (5-10 minutes) to auto-save the table, or a function when you admin someone in-game or remove them as admin, it will save the table to the DataStore with the new adminList. When the script runs in-game, just use DataStore:GetDataStore() to get the saved adminList, if theres no adminList; make a function to use the script's adminList. |
|
|
| Report Abuse |
|
|
|
| 17 Jan 2015 01:41 AM |
| So what would it look like? |
|
|
| Report Abuse |
|
|
|
| 17 Jan 2015 01:56 AM |
| How would I use data store on a table? |
|
|
| Report Abuse |
|
|
|
| 17 Jan 2015 02:26 AM |
| blah:SetAsync(key, {tab, tab, tiewioewieroewioerwioewrioerwioewrioewrioewioewio}) |
|
|
| Report Abuse |
|
|
parkiet3
|
  |
| Joined: 16 Jul 2011 |
| Total Posts: 832 |
|
|
| 17 Jan 2015 06:39 AM |
| Make a string of the table, then save the string. I did it |
|
|
| Report Abuse |
|
|
|
| 17 Jan 2015 11:53 AM |
Datastore's can save tables, numbers, and strings.
local DataStore=game:service'DataStore':GetDataStore'somerandomkey'
local adminList={ 'Player1', 'Telamon', 'ROBLOX' }
if DataStore:GetAsync'Admin List'then if adminList~=DataStore:GetAsync'Admin List'then adminList=DataStore:GetAsync'Admin List' end else DataStore:SetAsync('Admin List',adminList) end
|
|
|
| Report Abuse |
|
|
|
| 17 Jan 2015 06:45 PM |
| Oh I see, so you can just use the variable of the table and make that the key for Data Store. Thanks everyone! |
|
|
| Report Abuse |
|
|