Heres the code
local hs = game:GetService("HttpService")
local event = game:GetService("ReplicatedStorage"):WaitForChild("send")
local url = "https://discord.com/api/webhooks/webhookurl"
event.OnServerEvent:Connect(function(plr,message)
local data = {
["content"] = message,
["username"] = plr.DisplayName
}
local data = hs:JSONEncode(data)
hs:PostAsync(url,data)
end)
local event = game:GetService("ReplicatedStorage"):WaitForChild("customsend")
event.OnServerEvent:Connect(function(plr,url,message,oname,oname2,ourl,ourl2)
local data2 = {
}
if oname ~= false and oname2 ~= nil then
data2 = {
["content"] = tostring(message);
["username"] = tostring(oname2)
}
end
if ourl ~= false and ourl2 ~= nil then
data2 = {
["content"] = message;
["avatar_url"] = tostring(ourl2)
}
end
if ourl ~= false and ourl2 ~= nil and oname ~= false and oname2 ~= nil then
data2 = {
["content"] = message;
["username"] = tostring(oname2);
["avatar_url"] = tostring(ourl2)
}
end
local dataa = hs:JSONEncode(data2)
hs:PostAsync(url,dataa)
end)
I made a game that allows you to POST to discord webhooks.
