FindData = function(plr,level, gold) local success, msg = pcall(function() GetData = PlayerData:GetAsync(plr.UserId) end) if success then if GetData then level.Value = GetData gold.Value = GetData else level.Value = 1 gold.Value = 0 end else print("Data could not be saved.") end end
I'm trying to create error handling for my datastore so that I don't encounter any bad errors that could remove purchases (with ingame gold or even robux)
I have this function to get player data and I'm not sure how to test if it'd work or not if there was an error? I'm nervous someone will spend robux to get some perks and then loose their purchase e.g buying gold and loosing their data?