I’ve been working on a function for a game to update players data. Everything works fine until I want to try and add in a webhook embed to send to our discord. The pcall worked before trying to post the table, but now all I receive is Bad request, error 400.
Everything else works but the discord Post
game.ReplicatedStorage.EditGet.OnServerEvent:Connect(function(Admin, DataType, username, DataEnter)
local key = tostring(getUserIdFromUsername(username))
local RealName = getUsernameFromUserId(key)
local woobhookembed = {
["username"] = "Stat Update Logs",
["embeds"] = {{
['title']="Stats System uwu",
["thumbnail"] = {
["url"] = game:GetService("Players"):GetUserThumbnailAsync(tonumber(key), Enum.ThumbnailType.AvatarThumbnail, Enum.ThumbnailSize.Size420x420),
},
['type']="rich",
['color']=tonumber(0xd40003),
['fields']={
{
['name']="User Info",
['value']="User " .. RealName.." :: ID ".. tonumber(key),
['inline']=true
};
{
['name']="Admin who changed stats",
['value']=Admin,
['inline']=true
};
{
['name']="Data Type",
['value']=DataType,
['inline']=true
};
{
['name']="New Value",
['value']=DataEnter,
['inline']=true
};
}
}
}
}
if ExternalDataStore:GetAsync(key.."/"..DataType) == nil then
warn"Responce: Data type does not exist"
elseif ExternalDataStore:GetAsync(key.."/"..DataType) then
local success, err = pcall(function()
ExternalDataStore:SetAsync(key.."/"..DataType, tonumber(DataEnter))
end)
if success then
HTTP:PostAsync(woobhook, HTTP:JSONEncode(woobhookembed))
warn"Responce: Successfully updated player data"
end
end
end)
Image: