In my datastore system, I want to be able to discern between a bad getasync() request, and a player simply not having a key in the datastore yet. The problem with this is that, as far as I’m aware, both will just return nil, and so my end of the system has no way to handle each seperately. If this can be done, then how?
Use a xpcall (or pcall if you’re going for simplicity) to catch the error and differentiate between bad getasync and no key
local s,r = xpcall(function()
return datastore:GetAsync(plr.UserId)
end, error(“Bad GetAsync Call”))
if not r then warn(“Player has no data”) end
1 Like
Thanks, I had a brainfart and forgot that a bad getAsync() call will throw an error, so I’ll that’ll diferentiate it lol
1 Like
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.