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

How to handle datastores failing from roblox?

My datastore system works fine, I have it so when I'm unable to get the datastore (if it's failing or down) it kicks the player, however recently datstores failed and I was kicked but my data was still overwritten. Should I be kicking players or not? What is the best way to handle errors from roblox?

1 answer

✓ Accepted answer

Wrap all datastore requests in pcall like so:

local success, message = pcall(function()
	Datastore:SetAsync(key, data)
end)

if not success then
	-- If the datastore failed, you should retry saving this player's data.
	warn("Datastore failed, retry saving the players data.")
else
	-- Everything worked!
	print("Datastore worked, saves stats accordingly.")
end

1 comment

0

I would also really recommend this article on saving data: http://robloxdev.com/articles/Saving-Player-Data

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