Should I be using UpdateAsync, SetAsync, or ProfileService?

I keep seeing posts about how I should use one or the other over the other ones, so which one should I use??? Oh and, for UpdateAsync, since it updates the data, should I use SetAsync for the first time a player joins the game, and then use UpdateAsync for the rest of the time?

I think you’re supposed to use :SetAsync() when the player has no data and use :UpdateAsync() when the player has data. Aside from that, what you choose to use is mostly preference.

This is far from true.

colbert2677 makes a great explanation here on SetAsync vs UpdateAsync:

@BlueBloxBlast I recommend reading the post I linked above as it explains the different between SetAsync and UpdateAsync very well.

However, I recommend using ProfileService as it has several benefits as explained here:


So for saving, it should be this?

local success, errormessage = pcall(function()
		myDataStore:UpdateAsync(playerUserId, function(oldData)
			return data

In short, the main reason UpdateAsync is better than SetAsync is because UpdateAsync considers the old value.

Here’s a comparison between Technical the two from another post:

Ohh, so the “or” part sets it to 0 if there is no old value/if the player joined for the first time?

And what does “key” mean? Is that the playerID?
And, sorry for so many questions, where does DataId come from, and why does it need to be in squiggly brackets?

So this would work?

	local playerUserId = player.UserId
	local data = {

		Cash = player.leaderstats.Cash.Value;
		Rebirths = player.leaderstats.Rebirths.Value;


	local success, errormessage = pcall(function()
		myDataStore:UpdateAsync(playerUserId, function(oldData)
			local previousData = oldData or {DataId = 0}
			if data.DataId == previousData.DataId then
				return data
				return nil

How should I use GetAsync? I tried doing it the way you would with SetAsync, but the data = nil.