Grabbing player avatar images from link

So it appears Roblox recently changed how they generate images of users’ avatars, which has broken a minor function of one of our webhooks.

Originally, we used the line

avatar_url = "http://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&userId="..player.UserId

to grab an image of the player’s avatar. This has since broken.

Due to the nature of the way we’re doing this, I don’t think we’d be able to use
Players:GetUserThumbnailAsync, as that’s more for GUIs and things in-game as opposed to external resources.

Currently, when I try to get my own avatar image, it gives me a URL like this:
https://tr.rbxcdn.com/96974da4e61b4f672f56c4c6001c0e29/352/352/Avatar/Png
Which, sadly, doesn’t incorporate the user’s ID at all. Instead, it seems to generate a completely different, longer identifying string. Going through the properties of Player on Documentation, there’s no such thing I can call, so getting this string seems to be impossible.

Does anybody know about any other way to get the link to an image of a user’s avatar using their user ID? It just makes life easier.
This is totally just a silly feature of our webhook which gives face-to-a-name effectively, and we don’t really need it at all, we just like it a lot.

1 Like

‘rbxthumb://type=Asset&w=420&h=420&id=’ …player.UserId

Breaks the script- throws a HTTP 400 error.
It seems it has an issue with the lack of it being an actual link.

1 Like

AAAND found a fix.
Though our original used the full avatar image, the headshot will do!

 "https://www.roblox.com/headshot-thumbnail/image?userId="..player.UserId.."&width=420&height=420&format=png"
3 Likes

Hey, there are image endpoints that you can use to get the full body, you can view them here.

1 Like

Hello! I’ve tried that solution since im having the same problem, but it doesnt show the image. Is there any fix for that? – Nevermind, i just formatted the thumbnail wrong.

1 Like

Look I found the same but full body > "https://www.roblox.com/avatar-thumbnail/image?userId="..player.UserId.."&width=420&height=420&format=png"

sorry for bumping but this doesn’t seem to work anymore, is there any other solution?

Nope. Roblox deprecated the avatar image endpoints and wants us to use the API. Problem is most of us don’t know how.

ahh that’s bad, thank you anyways.

I believe I’ve found a solution to this, tho this will require you to use (json/xml)

https://thumbnails.roblox.com/v1/users/avatar?userIds=IDHERE&size=100x100&format=Png&isCircular=false

this will return a JSON object like this:

{
   "data": [
      {
         "targetId": 1,
         "state": "Completed",
         "imageUrl": "https://tr.rbxcdn.com/4db69b7085238b92eb50048953c7dfb0/100/100/Avatar/Png"
      }
   ]
}

and you can access Image URL like this:

responseData.data[0].imageUrl

(the example is in javascript)
but it is similar in other languages

You can’t do that, you’d have to use a proxy as you’re not allowed to send get requests to roblox endpoints within games.

I’m unable to use them at all, as every get request that contains a roblox cdn link just gets censored/removed.

These two methods did not work for me;

shared.getAvatarUrl = function(user)
	local thumbnail_request = string.format("https://thumbnails.roproxy.com/v1/users/avatar-headshot?userIds=%d&size=48x48&format=png", user.UserId)
	local response = http_service:RequestAsync({
		Url = thumbnail_request,
		Method = "GET"
	});
	local b = response.Body
	print(b)
	print(b:match('"https:\/\/tr.rbxcdn.com\/.+["]'):gsub('"', ""))
	
	return b:match('"https:\/\/tr.rbxcdn.com\/.+["]'):gsub('"', "")

	
end
shared.getAvatarUrl = function(user)
	local thumbnail_request = string.format("https://thumbnails.roproxy.com/v1/users/avatar-headshot?userIds=%d&size=48x48&format=png", user.UserId)
	local response = http_service:RequestAsync({
		Url = thumbnail_request,
		Method = "GET"
	});
	
	local data = http_service:JSONDecode(response.Body).data
	
	return data[1].imageUrl

	
end