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

How to make a data store with tables?

Asked by 7 years ago
Edited 7 years ago

I need a data store that has three tables in it. I have this so far. I don't know how to make it so that it saved tables.

01local DATA = game:GetService("DataStoreService"):GetDataStore("SaveNames");
02 
03game.Players.PlayerAdded:connect(function(player)
04    local blocks = Instance.new("Folder", player)
05    local names = Instance.new("StringValue", blocks)
06    local positions = Instance.new("IntValue", blocks)
07    local sizes = Instance.new("IntValue", blocks)
08    blocks.Name = "Blocks"
09    names.Name = "Names"
10    positions.Name = "Positions"
11    sizes.Name = "Sizes"
12    if DATA:GetAsync(player.userId) then
13        names.Value = DATA:GetAsync(player.userId)[1]
14        positions.Value = DATA:GetAsync(player.userId)[2]
15        sizes.Value = DATA:GetAsync(player.userId)[3]
View all 22 lines...
0
This aint a request site greatneil80 2647 — 7y
0
Its a help site and I need help.. goldstorm950 65 — 7y
0
The point of SH is not to provide free scripts - which whatever way you put it, is exactly what you are asking for - but to provide help with existing code or a question with 'special permission' to be codeless. TheDeadlyPanther 2460 — 7y
0
You should try making a DataStore yourself, then show us the code you are having trouble with if you encounter a problem. TheDeadlyPanther 2460 — 7y
View all comments (3 more)
0
Ok ill post the datastore I have rn goldstorm950 65 — 7y
0
You can use :JSONEncode to turn a table into a string, then :JSONDecode to turn it back into a table. hiimgoodpack 2009 — 7y
0
So put it into a string to save it and then put it into a table to use it? goldstorm950 65 — 7y

Answer this question