Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Storing more than two values in a datastore?

Is it possible to do something like?

datastore:SetAsync(player.userId, false, 420)

If not, how would I be able to?

2 answers

✓ Accepted answer

You can store a table in the DataStore.

If you haven't used tables yet, learn more about them here

You would do it like this:

datastore:SetAsync(plr.UserId, {false, 420})

2 comments

1

I agree. This should work. You should also do this when you are trying to get it: "datastore:GetAsync(plr.userId)[1] -- Thats the 1st variable in it, which returns false"

0

Yes. [1] would get false, [2] would get 420, etc.

I would use a table, I've done it before, but recently forgot how. I think it would be

game.Players.PlayerRemoving:connect(function(p)
local dss = game:GetService("DataStoreService"):GetDataStore("ExampleName")
local data = {1 = 1, 2 = 2}
dss:SetAsync(p.UserId,data)
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.