Recently I was testing my game, and the datastores just happened to fail. They gave me a 500 error code, and then my GetAsync() request dropped. Anyways, my datastores use UpdateAsync(),so I thought this would not be a problem as it would just not save the users play session. However, when the GetAsync() request failed it set my collectibles, coins, etc. all to 0. Then, when I left the game saved all of my stats as 0. So, I am basically looking for a way to tell if a GetAsync request fails. If it does, I would like to kick the player WITHOUT saving their data. I know how to kick them/not save the data, I am just lost on how to tell if my GetAsync() request fails.
I have wrapped it in a pcall, I am not 100% certain on the way that success works though. Is success true until an error occurs, or is it false until the pcall finishes?
local success,errmsg = pcall(function()
GetAsync(data) -- ur GetAsync code here
end)
if not success then
warn("big chungus alert, Roblox trashy datastore failed!")
end