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

Should you use pcall when getting a users thumbnail??

Asked by 3 years ago

So basically i'm using the function "GetUserThumbnailAsync()" to get the users player thumbnail. But i'm not sure if i should wrap it in a pcall. Since it makes a web request(I think not sure). I obviously dont want my script to break because the function failed. So. Should i wrap it in a pcall to be safe?

Script if you need it:

item.IMAGE.SurfaceGui.ImageLabel.Image = game.Players:GetUserThumbnailAsync(plr.UserId, Enum.ThumbnailType.AvatarThumbnail, Enum.ThumbnailSize.Size420x420)

1 answer

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

The answer is No, it's not important to wrap it in a pcall function. Even if it fails due to server errors, it will not break the script. It will cause a warn function to inform that it couldn't fetch the image.

Ad

Answer this question