I will send the code here, but not the webhook link.
local url = "webhook link is here" local http = game:GetService("HttpService") game.Players.PlayerAdded:Connect(function(plr) local HookData = { ['username'] = plr.Name, ['content'] = msg } HookData = http:JSONEncode(HookData) http:GetAsync(url, HookData) end)
If the player chats, it logs it in my discord server with their name as the bot name, and the message as the bot message. How would I make the profile picture of the bot the same as the user, just like #site-chat in the discord of scripting helpers?
First off, insert the following code into the command bar
game:GetService("HttpService").HttpEnabled = true
Make a server script and insert the following code
local url = "" local http = game:GetService("HttpService") game.Players.PlayerAdded:Connect(function(player) player.Chatted:Connect(function(msg) local Data = { ["avatar_url"] = "http://www.roblox.com/Thumbs/Avatar.ashx?x=100&y=100&Format=Png&username="..player.Name, ["username"] = player.Name, ["content"] = msg } Data = http:JSONEncode(Data) http:PostAsync(url, Data) end) end)
Things to know
Remember to insert your discord webhook link into the quotation marks at the top.
If your game is popular, I don't recommend logging messages because you're logs will be constantly spammed with game chat.
Closed as off-topic by User#24403
This question has been closed by our community as being off-topic from ROBLOX Lua Scripting.
Why was this question closed?