L3AGLE
(L3AGLE)
December 21, 2019, 8:35pm
#1
Hello,
I am fairly new to saving tables to datastores. Could someone show me a full simple example of how to do that please?
I am currently trying to save this table :
[Player_UserId] = {
PackedCards = {},
NewCards = {},
DuplicateCards = {},
}
You can use HttpService’s JSONEncode and JSONDecode functions to convert tables to strings (and strings back to tables). You can then save these strings as usual!
Relevant article: HttpService | Documentation - Roblox Creator Hub
1 Like
L3AGLE
(L3AGLE)
December 21, 2019, 8:48pm
#3
I’ve heard you don’t always need to do that since Datastores support tables.
As far as I know, DataStores do not save tables.
Did you try saving the table?
L3AGLE
(L3AGLE)
December 21, 2019, 8:56pm
#5
There’s a good chance you’re wrong but I am not sure lol.
gillern
(gillern)
December 21, 2019, 8:57pm
#6
They 100% do support tables
local DS = game:GetService("DataStoreService"):GetDataStore("TestDataStore")
DS:SetAsync("TestKey", {Adam = "Sandler"})
print(DS:GetAsync("TestKey").Adam) --Sandler
4 Likes
L3AGLE
(L3AGLE)
December 21, 2019, 9:02pm
#7
Hello,
Guess I was right.
I will try this out, thank you!
Thank you @Intended_Pun as well
1 Like