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

Reasons for failure pcall on UpdateAsync()?

In solo mode(not online mode), does pcall return false with :UpdateAsync at all times?


		local success, message = pcall(PlayerData:UpdateAsync(key, function(oldValue)
			return Data
		end))

This could mess up my datastore system where I forceload any missing data and try to revive the player's data.

It states it's a failure but the data is successfully stored..

1 answer

✓ Accepted answer

You are pcalling the value returned by PlayerData:UpdateAsync, not the function call itself. To correct this, simply create an anonymous function for use by pcall:

local success, message = pcall(function()
	PlayerData:UpdateAsync(key, function(oldValue)
		return Data
	end)
end)

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