Do I use :SetAsync() or :UpdateAsync()?

I know the basic answer would be using UpdateAsync, but in my scenario I have a table that saves strings and an intvalue that has the possibility of going down, I have read in some posts that :UpdateAsync() is for values that only go up, however I am using a number value that also goes down alongside with up. Do I use :SetAsync() or is there a way to achieve this with :UpdateAsync()?

--The table I am saving with default values:
	{
		["Costumes"] = {
			["Dan"] = "false",
			
			["Alex"] = "false",
			
			["FemalePlaceholder"] = "false",
			
			["Princess"] = "false",
			
			["Betty"] = "false",
			
			["Matilda"] = "false",
			
			["Demon"] = "false",
			
			["Fairy"] = "false",
			
			["Angel"] = "false",
		},
		
		["Currencies"] = {
			["Candy"] = 0
		},
		
		["EverPlayed"] = "false",
	}

You can simply save with UpdateAsync by returning the table.

local info = {
		["Costumes"] = {
			["Dan"] = "false",
			
			["Alex"] = "false",
			
			["FemalePlaceholder"] = "false",
			
			["Princess"] = "false",
			
			["Betty"] = "false",
			
			["Matilda"] = "false",
			
			["Demon"] = "false",
			
			["Fairy"] = "false",
			
			["Angel"] = "false",
		},
		
		["Currencies"] = {
			["Candy"] = 0
		},
		
		["EverPlayed"] = "false",
	}

-- this should be wrapped in a pcall
DataStore:UpdateAsync(key, function()
    return info -- this is how you'd save the table of data
end)
1 Like

Ah okay, I wasn’t sure if I could save a table with :UpdateAsync() thanks!