function PlayerThumbnailUtils.promiseUserThumbnail(g,V,j)assert(type(g)=="\110\117\109\098\101\114","\066\097\100 \117\115\101\114\073\100")V=V or Enum.ThumbnailType.HeadShot j=j or Enum.ThumbnailSize.Size100x100 local O O=Promise.spawn(function(f,n)local c=0 repeat c=c+1 local R,o local p,Q=pcall(function()R,o=Players:GetUserThumbnailAsync(g,V,j)end)if not p then return n(Q)end if o then return f(R)else task.wait(.05)end until c>=MAX_TRIES or not O:IsPending()n()end)return O end
--[=[
	Promises a user thumbnail with retry enabled.

	```lua
	PlayerThumbnailUtils.promiseUserThumbnail(4397833):Then(function(image)
		imageLabel.Image = image
	end)
	```
	@param userId number
	@param thumbnailType ThumbnailType?
	@param thumbnailSize ThumbnailSize?
	@return Promise<string>
]=]
function PlayerThumbnailUtils.promiseUserThumbnail(userId, thumbnailType, thumbnailSize)
	assert(type(userId) == "number", "Bad userId")
	thumbnailType = thumbnailType or Enum.ThumbnailType.HeadShot
	thumbnailSize = thumbnailSize or Enum.ThumbnailSize.Size100x100

	local promise
	promise = Promise.spawn(function(resolve, reject)
		local tries = 0
		repeat
			tries = tries + 1
			local content, isReady
			local ok, err = pcall(function()
				content, isReady = Players:GetUserThumbnailAsync(userId, thumbnailType, thumbnailSize)
			end)

			-- Don't retry if we immediately error (timeout exceptions!)
			if not ok then
				return reject(err)
			end

			if isReady then
				return resolve(content)
			else
				task.wait(0.05)
			end
		until tries >= MAX_TRIES or (not promise:IsPending())
		reject()
	end)

	return promise
end
