So I have a script that uses UpdateAsync.
How would I put it into a pcall with succes and the errormessage?
That way I can tell if there is an error.
local function saveData(player)
local tag = player.UserId..'_profile'
local profile = player.Profile
-- lets detect if there was no error
if not player:FindFirstChild('Failed') then
print('No error, updating data')
local currentData = {
gems = profile.Gems.Value,
}
profileStore:UpdateAsync(tag, function(pastData)
print(pastData)
return currentData
end)
else
print('Error. We are not going to update there data')
end
end