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)
@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