How do I get a link of a player's profile picture to send it trough a discord webhook

Im trying to send a message trough a discord webhook every time someone opens an egg in my game. How can I send a image of the player who opened the egg trough the webhook too?

My script is:

HS = game:GetService("HttpService")
WebhookURL = "my webhook url"
zahl = 0

function sendDiscordMsg(plr,pet)
	local MessageData = 
		{
			["content"] = "",
			["embeds"] = {{
				["title"] = plr.." got a "..pet.." pet!",
				["type"] = "rich",
				["color"] = tonumber(0xffffff),
				["thumbnail"] = {
					["url"] = userimage,
				},              
			}}
		}
	MessageData = HS:JSONEncode(MessageData)
	HS:PostAsync(WebhookURL,MessageData)
end



script.Parent.Triggered:Connect(function(plr)
	
	local InvSlots = plr.PlayerGui.ScreenGui.Inventory.Slots
	
	zahl = math.random(0,100)
	print(zahl)
	
	-- game.ReplicatedStorage.EggAnimation:FireClient(plr)
	
	if zahl >= 0 and zahl <= 50 then
		InvSlots.common.Amount.Text = InvSlots.common.Amount.Text + 1
		sendDiscordMsg(tostring(plr),"common")
	elseif zahl >= 51 and zahl <= 70 then
		InvSlots.rare.Amount.Text = InvSlots.rare.Amount.Text + 1
		sendDiscordMsg(tostring(plr),"rare")
	elseif zahl >= 71 and zahl <= 99 then
		InvSlots.epic.Amount.Text = InvSlots.epic.Amount.Text + 1
		sendDiscordMsg(tostring(plr),"epic")
	elseif zahl == 100 then
		InvSlots.legendary.Amount.Text = InvSlots.legendary.Amount.Text + 1
		sendDiscordMsg(tostring(plr),"dino")
	end
end)

To get the link of a player’s profile, just do

local content = Players:GetUserThumbnailAsync(plr.UserId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size420x420)

The content will be the image ID

1 Like

And how do I correctly send that trough the webhook? I get a HTTP 400 Bad Request error…

Are you using a proxy? Discord disabled webhook requests from Roblox.

Nope im not, how does that work?

I think this article will explain the situation.

From what ive read i would have to set up a whole webserver for that then… i cant do that but thank you for sharing this post

You can check this out:

There’s no other way to send webhooks without a proxy. Discord have banned all incoming Roblox requests, so your system won’t work without one.

@VeriBaesix I cant figure out how to correctly send that trough the webhook, if i try with a imgur link it works (but fails to load inside discord for some reason) and if i try to send the image of the ingame character i get a Bad Request error

bro wants to send a rbxthumb:// link to discord

4 Likes