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!
Im trying to make it so when a player joins it sends a message to a webhook on my discord with a button -
What is the issue? Include screenshots / videos if possible!
Just says “Error 400 (Bad Request)” in the console. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have looked and they all tell me to use WebhookProxy or smth like that, but i wanna do it with a simple api request
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local HTTPService = game:GetService("HttpService")
local url = "https://discord.com/api/webhooks/no/no"
game.Players.PlayerAdded:Connect(function(plr)
local data = {
["content"] = "Player joined the game: "..plr.Name,
["components"] = {
{
["type"] = 2,
["label"] = "Click me!",
["style"] = 5,
["url"] = "https://www.example.com"
}
}
}
local encodeddata = HTTPService:JSONDecode(data)
HTTPService:PostAsync(url, encodeddata, Enum.HttpContentType.ApplicationJson, false)
end)
edit: i know its not that the script is wrong because i’ve checked the dev portal on discord