Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What will cause a pcall of getasync to fail?

Asked by 4 years ago
Edited 4 years ago
game.Players.PlayerAdded:Connect(function(plr)
local S,E = pcall(function()
    local GotAsync = DataStore:GetAsync(plr.UserId)
end)

if S then

if E then -- what will cause this to fire?
0
if there is no plr data or the game has a problem with getting data from roblox DollorLua 235 — 4y
0
Data store requests are web requests, and you can't guarantee that all web requests will be always successful. User#24403 69 — 4y

1 answer

Log in to vote
-2
Answered by
sheepposu 561 Moderation Voter
4 years ago
Edited 4 years ago

The pcall function is there because it is not guaranteed that the player has data already saved. If the DataStore can't find the data saved, it will return an error.

0
This is simply not true. BlueTaslem 18071 — 4y
Ad

Answer this question