There is an official method for grabbing the thumbnail called Players/GetUserThumbnailAsync. Remember to wrap it in a pcall and send a fallback if it fails.
local ThumbnailGet = HS:GetAsync("https://thumbnails.roproxy.com/v1/users/avatar-headshot?userIds="..UserID.."&size=48x48&format=Png&isCircular=false")
local data = HS:JSONDecode(ThumbnailGet).data[1]
local imageURL = data.imageUrl
Doesn’t work for me, check the thread. I’m doing the same thing as you but for some reason when I print out the body I don’t get the whole headshot link
The reason I suggested it was because the behavior could differ from RequestAsync.
Are you sure you are inputting the UserID correctly? Did you try what I sent?
I need a bit more info to help.
Sorry to bump but I would like to know if anyone has figured out what could be done as a workaround for this. I’m dealing with the same thing, so I’m pretty dumbfounded.
Here is an image of what im doing,
And here are some images comparing the response body on the website and the response body in-game,
I have a part on the workspace with a decal inside of it shaped like a picture.
--local script
local Player = game:GetService("Players").LocalPlayer
local userid = Player.UserId
local image = game.Players:GetUserThumbnailAsync(userid,Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size150x150)
workspace.Pic.Decal.Texture = image
This is a snippet of it being used with a highscore board.
local pages = dataKey:GetSortedAsync(false, 100, 1, 10e15) -- 10e30 -- T↓/F↑, 1-100, Lowest, Highest
local page, data = pages:GetCurrentPage(), {} -- First page / Create new data
for _, dat in ipairs(page) do -- Loop through data
local username = "[Failed To Load]" -- preset
local userid, points = dat.key , dat.value -- User
local suc, err = pcall(function() -- Get username
username = game.Players:GetNameFromUserIdAsync(userid)
end) if suc == true then -- add user image to table
local image = game.Players:GetUserThumbnailAsync(userid,
Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size150x150) -- Add player image
table.insert(data, {username, points, image})
else warn("Getting name for "..userid..". Error: "..err)
end
end
This is not the full script but it is showing how to slip this in a highscore board.
Just found out that the value for “imageUrl” does get provided when you get it in the script, you just cannot print it into the console (which is weird)