You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I want to send a webhook to a discord channel whenever a player is reported. -
What is the issue? Include screenshots / videos if possible!
HTTP 400 BAD REQUEST -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have tried every related topic.
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local createPartEvent = Instance.new("RemoteEvent", ReplicatedStorage)
createPartEvent.Name = "reportmusic"
local function reportmusic(player, reason, Username)
local id = game.Players[Username]:GetAttribute("CurrentMusicID")
print(Username)
local HttpService = game:GetService ("HttpService")
local webhook = "https://discord.com/api/webhooks/xxxxx/xxxxxxxxxxxxxx"
local data =
{
["content"] = "",
["embeds"] = {{
["title"] = "New Report!",
["description"] = {player},
["type"] = "rich",
["color"] = tonumber(0xffffff),
["fields"] = {
{
["name"] = "Username",
["value"] = tostring(Username),
["inline"] = true
},
{
["name"] = "Reason",
["value"] = tostring(reason),
["inline"] = true
},
{
["name"] = "Current audio ID",
["value"] = tostring(id),
["inline"] = true
}
}}
}
}
local jsonData = HttpService:JSONEncode(data)
HttpService:PostAsync(webhook, jsonData)
end
createPartEvent.OnServerEvent:Connect(reportmusic)
Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.