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

How to save a table to a data store?

Asked by 6 years ago

Yeah, that's it. The wiki is useless. Thanks for your help in advance.

0
Just pass the table as the save value. User#5423 17 — 6y
0
How? SebbyTheGODKid 198 — 6y

1 answer

Log in to vote
2
Answered by 6 years ago
local DSService = game:GetService("DataStoreService")
local savedTable = DSService:GetDataStore("savedTable")
local table = {"One", "Two", "Three"}

savedTable:SetAsync("Key", table)

You save a table just as you would save any other value. Usually for the key I use the player's UserId so that every player has a unique key that their data is held in.

0
Thanks! Glad to see a trusted scripter is always willing to help. :D SebbyTheGODKid 198 — 6y
Ad

Answer this question