Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Can Somebody help me Understand how to save,read and update Tables in DataStore?

Asked by 6 years ago
Edited 6 years ago

My Datastore is organized like:Datastore Name>Scope>PlayerId as key>Actual Data. So Key for each players data is their Id.

I know that When you set the key like I do it creates an empty list. What I'm having trouble with is reading this data and rewriting it.

I tried using Http Service and JSONDecode, JSONEncode but that way it saves one string and to access that you have to Decode and then take values from table manually. I just need help to know how to save tables correctly and do it in best way

This is my script which doesn't even work properly.

01local datastore = game:GetService("DataStoreService")
02hs = game:GetService("HttpService")
03default_data = {["Money"] = 4000,
04    ["Houses"] = {
05        ["Standard"] = false,
06        ["Normal"] = false,
07        ["High"] = false,
08        ["Lux"] = false
09    }
10    }
11 
12game.Players.PlayerAdded:connect(function(plr)
13    ds1 = datastore:GetDataStore("GameData123","01")
14 
15 
View all 56 lines...

Answer this question