local S,E = pcall(function()
DataStore:GetAsync(Player.UserId)
end)
print(S,E) -- Prints true, nil
local S,E = pcall(function()
return DataStore:GetAsync(Player.UserId)
end)
print(S,E) --Prints true, a Number if got
So what I was wondering for datastores which one was better
and if its safe setting a IntValue based on E
if S and E then
IntValue.Value = E
end
Also when should you return something in a pcall

1 comment
You can never be too safe, if an error may be thrown at you, you want to make sure the thing called is protected and runs with a pcall