If I wanted to save a table that listed all the items a player has in game to the data store, could I? Is it even possible?
Yep. Data Store is designed to handle:
You can just enter a table in there!
So, side note: Data Persistence allowed to save instances: Data Store cannot (directly) do this. Data Store can save tables: Data Persistence cannot directly do this.
Yes you can the script may contain error
local table = {a = "0",b = "0"} -- The main table local ds = game:GetService("DataStoreService") -- datastore service local hs = game.HttpService -- the http service local nds = ds:GetDataStore("test") local value = hs:JSONDecode(nds) if value == nil then -- if it the first time you start the game then you start with the main table value = table else value.a = value.a + 1 --we want to add 1 to a every time value.b = value.b + 2 --we want to add 2 to b every time end local encode = hs:JSONEncode(value) hs:SetAsync("test",encode) -- may be it (encode,"test")
" Introduction
ROBLOX is introducing a new API for storing data called Data Stores which is more powerful and robust than the old Data Persistence system. With Data Stores you can store arbitrary data which persists even when games are not running and can be accessed by all instances of a place in your game universe. You probably have used Data persistence. If you haven't, it's strongly suggested to learn how to use the Data Stores instead of the old Data Persistence. Here's a small overview on advantages over Data Persistence. For the disadvantages, see the limitations section. Data Stores have virtually no data limit. Data Persistance has a limit of 45000 data units per player. Data Stores are accessible from any place at any time in the same universe. If a call from the Data Store API returns, the data is confirmed to be saved. So, not data loss when a server crashes. Saves arbitrary lua tables, besides strings, booleans and numbers. Instances cannot be saved direcly though. We can test data stores in a local test server. If you are going to intensively use Data Stores, make sure that you have read the the limitations section too, to prevent frustrations later on. "
This is directly from Roblox Wiki -> http://wiki.roblox.com/index.php?title=Data_store