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

With DataSave, possible to save 2 values to 1 save?

Basically I'm trying to make a game where people buy 'carts' and can upgrade them from 1-5. I would like to save the carts they own, and the upgrades they added on that cart.

I understand with data save you can have multiple values saved, like

[1] = 1 [2]= 4

So when using :GetAsync you can get the first or second value.

I was wondering if you could get the values to strings for example

["Red Cart"] = 1 ["Blue Cart"] = 4

Something like that. And when I used :GetAsync I could search for the string I needed and the number that pertained to the string. If there's no way to do that how do I go around that?

1 answer

Yup, you can. By saving a table, you're able to save a lot of data at once. For instance:

local data = {
	Carts = {
		Blue = 4,
		Red = 1
	}
}

pcall(function()
	:SetAsync(player_id, data)
end)

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