Description
This script isn’t working and I think it should, I’m unsure why and I’m asking for help here. It is supposed to send a message to Discord in a web hook way.
Organization
Code
local URL = https://hooks.hyra.io/api/webhooks/1056584400508289046/Z-zpMAPtrfWm3VG7q1s_a7rMCqwleXAl01iJ8Mju7FuRxIz-zgj30mbdSncJSPlVe__X
local Players = game:GetService("Players")
local HttpService = game:GetService("HttpService")
local function postMessage(player, index)
local teamValue
pcall(function()
if not player.Team then
teamValue = "Player"
else
teamValue = player.Team.Name
end
end)
local data = {
["content"] = "";
["embeds"] = {{
["author"] = {
["name"] = player.Name;
["icon_url"] = "https:www.roblox.com/headshot-thumbnail/image?userId="..player.UserId.."&width=150&height=150&format=png";
};
["description"] = "Said **"..index.."**",
["color"] = tonumber(0xffffff);
["fields"] = {
["name"] = "Identifier";
["value"] = player.UserId;
["inline"] = true
};
{
["name"] = "Existance";
["value"] = player.AccountAge.." days";
["inline"] = true
};
{
["name"] = "Team";
["value"] = teamValue;
["inline"] = true
};
{
["footer"] = {
["icon_url"] = "https://www.roblox.com/library/5890405543/Images-NokoCafe";
["text"] = "Nokó System 2023™"
}
};
}}
}
local finalizedData = HttpService:JSONEncode(data)
HttpService:PostAsync(URL, finalizedData)
end
local function PlayerAdded (Player)
Player.Chatted:Connect(function(Message)
postMessage(Player, Message)
end)
end
for _, Player in ipairs(Players:GetPlayers()) do
PlayerAdded(Player)
end
Players.PlayerAdded:Connect(PlayerAdded)
Thank you for your collaboration.