Hello, I ran into a problem when wanting to send a webhook whenever a player has joined. The JSON data I wanted to post to my webhook looks like this:
{
"embeds":[
{
"color":65280,
"fields":{
"name":"Player properties",
"value":"Premium membership: false\nCountry: :flag_de: Germany"
},
"title":"A player has joined",
"description":"Doct0r_Br1ght (562332673) has joined the game!"
}
]
}
It somehow works for the leave embed, now I wonder what I did wrong while sending the first embed.
This is the JSON for the second embed:
{
"embeds":[
{
"color":16711680,
"title":"A player has left!",
"description":"Doct0r_Br1ght (562332673) has left the game!\n>>> Minutes spent: 0\nPremium: false"
}
]
}
This is the lua code for both:
-- (webhookLink, plr and HttpService are defined)
local joinEmbed = {
["title"] = "A player has joined",
["description"] = plr.Name.." ("..tostring(plr.UserId)..") has joined the game!",
["color"] = tonumber(0x00ff00),
["fields"] = {
["name"] = "Player properties",
["value"] = tostring("Premium membership: "..tostring(plr.MembershipType == Enum.MembershipType.Premium).."\nCountry: :flag_"..plrLocation:lower()..": "..countryTable[plrLocation])
}
}
HttpService:PostAsync(webhookLink, HttpService:JSONEncode({ ["embeds"] = { joinEmbed } }))
local leaveEmbed = {
["title"] = "A player has left!",
["description"] = plr.Name.." ("..tostring(plr.UserId)..") has left the game!\n>>> Minutes spent: "..plr.leaderstats.Minutes.Value - savedTime.."\nPremium: "..tostring(plr.MembershipType == Enum.MembershipType.Premium),
["color"] = 0xff0000
}
HttpService:PostAsync(webhookLink, HttpService:JSONEncode({ ["embeds"] = { leaveEmbed } }))
Thrown error: