This API allows you to get the Content URL for a user thumbnail and check if it is generated (i.e not N/A). If the requested image is N/A then it will be added to the thumbnail queue to be generated. The API can be called multiple times until the image is ready to be displayed.
The full method signature is as follows:
-- The first return value is the image URL
-- The second is a bool indicating whether the image is generated or not,
-- if this is false then the image will be N/A when displayed.
Content, bool GetUserThumbnailAsync (
int userId,
ThumbnailType thumbnailType,
ThumbnailSize thumbnailSize
)
Here is the Roblox wiki page with more information:
For an example of how this can be used to avoid showing N/A thumbnails or regenerate N/A thumbnails see this upcoming CoreScripts change which uses the API to avoid showing N/A user thumbnails in the Core UI where possible.
Thanks. And I assume that no thumbnail gets returned for guests. My tests on a local server returns an image for negative user ids, but it is a generic “broken” image, and not the real thumbnail of the player.
It’s new? I thought I saw these functions before.
Either way, thank you for this. Now I don’t have to do intense digging or write out odd lines of code. Pump this function out, get beautiful code organization and what I need without complications.
Just putting random resolutions in the thumbnail url doesn’t generate any picture, but the resolution 250x250 does, so it should be a ThumbnailSize enum aswell.
So the useage for this is… when a player joins, loop through all players in the game and call this function on their userid to ensure the avatars get generated.
Then set up a player added event locally and call this function on each new player that joins?
You don’t need to pre-generate all the user thumbnails necessarily, you can use this function to spend a few seconds retrying to get the thumbnail while the N/A image is displayed.
A good example of this is the following function used by the CoreScripts which will try to get the valid thumbnail image for a few seconds before falling back to the possibly N/A thumbnail link: