I am making a Discord Webhook for the chat in Roblox. So, whenever somebody talks in the game, it announces it in this separate channel on Discord. I've tested it out several times in Roblox Studio and it said in the Discord chat what I said in Roblox Studio, which is amazing! I then save the game and go to the actual game and test it out, but whenever I say something in the game, it doesn't appear in the Discord channel. I thought it didn't save, so I went back to Roblox Studio and it did save. I then added a model to make sure, left then rejoined and the model was there. I've tried several different ways. The script is below. Please help!
local url = WEBHOOK URL (not saying the actual webhook url here) local https = game:GetService("HttpService") game.Players.PlayerAdded:Connect(function(player) player.Chatted:Connect(function(msg) local data = { ["embeds"] = {{ color = 000000, title = "Training Chat Bot", fields = { { name = player.Name, value = msg } } }} } local newdata = https:JSONEncode(data) https:PostAsync(url,newdata) end) end)
I've had a look and it, and it surprisingly works for me now. I've removed you an extra line of code and crammed it into the https:PostAsync()
section.
local url = "url" local https = game:GetService("HttpService") game.Players.PlayerAdded:Connect(function(player) player.Chatted:Connect(function(msg) local data = { ["embeds"] = {{ color = 000000, title = "Training Chat Bot", fields = { { name = player.Name, value = msg } } }} } https:PostAsync(url,https:JSONEncode(data)) end) end)
Please accept this answer if you felt it helped.