You can write your topic however you want, but you need to answer these questions:
I want to be able to send a message from Roblox to my webhook. For some reason, it only works in studio not in-game. I have tried to find solutions, but couldn’t find any.
Here are my scripts
This one is the regular one.
local Webhook = require(script.Webhook)
local WebookSender = game:GetService("ReplicatedStorage").WebhookSender
WebookSender.OnServerEvent:Connect(function(Player: Player, Message: Message, WEBHOOK_URL: URL, COLOR: HEX)
Webhook:SendMessage(Player, Message, WEBHOOK_URL, COLOR)
end)
Here is the module
local HttpService = game:GetService("HttpService")
local Webhook = {}
function Webhook:SendMessage(Player: Player, Message: StringValue, WEBHOOK_URL: URL, COLOR: HEX) : "Sends a message"
local Data = {
["embeds"] = {{
["author"] = {
["name"] = Player.Name.."["..Player.UserId.."] ["..Player.AccountAge.."]"
},
["color"] = tonumber("0x"..COLOR),
["fields"] = {
{
["name"] = "Message: ",
["value"] = Message,
["inline"] = false
},
{
["name"] = "Date: ",
["value"] = os.date("%x").." "..os.date("%X"),
["inline"] = false
}
}
}}
}
Data = HttpService:JSONEncode(Data)
local Success, Error = pcall(function()
HttpService:PostAsync(WEBHOOK_URL, Data)
end)
if not Success then
warn(Error)
end
end
return Webhook
It works perfectly fine in studio, but doesn’t show up in-game.
It is also giving me an error called HTTP 403 (Forbidden)
If anyone knows how to fix that.