How do you make Discord Webhooks with your roblox game?

I’m trying to add chatlogs and kill logs and other things with a Discord Webhook but all the tutorials I have watched don’t work and I don’t receive any errors at all so I’m asking the devforum now.

This is a good example for chatlogs.

local http = game:GetService("HttpService")

game.Players.PlayerAdded:Connect(function(plr)
plr.Chatted:Connect(function(msg)
local content = {
["content"] = game:GetService("TextService"):FilterStringAsync(msg,plr,plr)
}
http:PostAsync("YOUR_WEBHOOK_LINK",http:JSONEncode(content))
end)
end)

(I haven’t tested it, but it should work.)

@IntelligentCappy @Cvexreos If you’re planning on using chat logs for your game, be careful that you aren’t going over Discord’s rate limits for webhooks. I believe it’s 30 messages every 60 seconds or something.

I had to remove chat logs from my game recently because of constant HTTP 429 errors. It’s fine for smaller scale games, but for large games with 40+ or so people playing at one time, it starts to go over rate limits.

I made a whole package on Roblox that has everything for Discord.
Yes, I was making the full Discord API on Roblox. lol.

I have channels, and webhooks there with every function for the two that you can do on the discord api website.

Would this kit include kill logs for discord?

Yeah, you can use the same script the other person posted above and modify the info to include the kill feed content in the content variable.

You can also use a third party program like https://discohook.org/ to add other features like embeds or images.
The JSON output on that website is differently formatted to what Lua uses so you might have to mess around with the quotation marks or brackets to make it work.