Converting rbxthumb to image url

so I’ve got this script that sends a message to discord via webhook
but I’ve got one problem. the thumbnail doesnt work and I researched about it. I then found out that Players:GetUserThumbnailAsync() actually returned a rbxthumb instead of a https://
I then tried using the legacy url and this is what I have now
script in serverscriptservice:

local url = thisisprivate
local hs = game:GetService("HttpService")

game:GetService("ReplicatedStorage"):WaitForChild("SendFeedback").OnServerEvent:Connect(function(player, feedback)
    local data = {
        content = feedback,
        embeds = nil,
        username = string.format("%s (%s)", player.DisplayName, player.Name),
        avatar_url = "https://www.roblox.com/headshot-thumbnail/image?userId="..player.UserId.."&width=420&height=420&format=png"
    }
    
    local finaldata = hs:JSONEncode(data)
    hs:PostAsync(url, finaldata)
end)

what i get:
IMG_0984

I saw a post that can be helpful as I don’t know much about apis

1 Like

that solution is outdated since the thumbnails site is not in use anymore and instead errors the script

1 Like

You sadly have to use a Roblox api endpoint to achieve this.
Thankfully roproxy exists.

I put together a code for you here:

function headshotToURL(id)
	local icon_url = "https://thumbnails.roproxy.com/v1/users/avatar-headshot?userIds=" .. id .. "&size=420x420&format=Png&isCircular=false"
	local response = http:GetAsync(icon_url)
	local data = http:JSONDecode(response)
	return data["data"][1]["imageUrl"]
end

Output:
image

1 Like

thank you so much this worked perfectly!

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.