Profile Picture with Discord WebHook and Replit

I’m trying to upload an image of the player to discord, and I get an empty image, would it be ok to pass the image this way:

‘https://www.roblox.com/Thumbs/Avatar.ashx?x=420&y=420&username=’ .. playerName

everything I saw on the forum didnt help me

Sending Discord that link will not work because Roblox has deprecated that web endpoint since at least 2021. Going to the link will just provide you with error 404. Roblox officially said this in a devforum post and here is also a screenshot of the post with the endpoint you are trying to use highlighted:

Instead you should be trying to get the https://tr.rbxcdn.com/ image URL but you cannot directly get this link from Roblox and have to use a Roblox proxy to send a get request to get the link. This is because Roblox does not allow you to directly send any requests to Roblox itself. Here is how I would probably do it:

local thumbnailURL:string = "https://thumbnails.roproxy.com/v1/users/avatar-headshot?userIds=%s&size=420x420&format=Png&isCircular=false"

-- Attempts to get the player's avatar headshot thumbnail
local function getThumbnail(player:Player)
	local userId:number = player.UserId
	local response:string = nil

	local success:boolean, errorMessage:string = pcall(function()
		response = HTTPService:GetAsync(thumbnailURL:format(tostring(userId)))
	end)

	if not success then
		warn(errorMessage)
		return placeholderThumbnailURL
	else
		return HTTPService:JSONDecode(response).data[1].imageUrl
	end
end

I haven’t tested this code for myself but it should work. You would just need to call this function and give it the player instance as an argument. In return, it will give you the thumbnail URL for Discord to use. Also if it outputs that there was a SSL connect fail, try connecting to a VPN because some ISPs block the proxy but this won’t happen in actual Roblox servers and only in studio.