Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

How to save a table to a data store?

Asked by 2 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 5 — 2y
0
How? SebbyTheGODKid 198 — 2y

1 answer

Log in to vote
1
Answered by 2 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 — 2y
Ad

Answer this question