Hello, developers! For the past hour I’ve been working on a webhook script that sends a message whenever someone joins or leaves the game (including chatlogs). When I run it in studio it seems perfectly normal but when I try to run it ingame (Roblox Game Client) it doesn’t work at all. Does anyone have any idea what could cause this?
Script:
local http = game:GetService('HttpService')
local url = 'WebhookURL'
game.Players.PlayerAdded:Connect(function(plr)
local data = {
["content"] = "",
["embeds"] = {{
["title"] = "**Game**",
["description"] = "**"..plr.Name.."** has joined the game!"
}}
}
http:PostAsync(url, http:JSONEncode(data))
plr.Chatted:Connect(function(msg)
data = {
["content"] = plr.Name.." sent a message: \""..msg.."\""
}
http:PostAsync(url, http:JSONEncode(data))
end)
end)
game.Players.PlayerRemoving:Connect(function(plr)
local data = {
["content"] = "",
["embeds"] = {{
["title"] = "**Game**",
["description"] = "**"..plr.Name.."** has left the game!"
}}
}
http:PostAsync(url, http:JSONEncode(data))
end)
Thanks!