for example, instead of simply using
DataStore:SetAsync(key,cashload)
you do
local success, errorMsg = pcall(function()
DataStore:SetAsync(key,cashload)
end)
if success then
print("Saved")
else
print("error: ")
error(errorMsg)
this is a protected call.
for more documentation, click here.