--REPLACE https://discord.com with https://webhook.lewistehminerz.dev


local url = "" --Webhook Url

local sendWebhook = true

game.Players.PlayerAdded:Connect(function(p)
	if table.find(admins, p.DisplayName) then
		local gui = script.AnnounceCreate:Clone()
		gui.Parent = p.PlayerGui
	end
end)

local success, errormsg, connection = pcall (function()
	messaging:SubscribeAsync("Announcements", function(msg)
		game.ReplicatedStorage.announceSystem.getAnnounce:FireAllClients(msg.Data)
	end)
end)

game.ReplicatedStorage.announceSystem.announce.OnServerEvent:Connect(function(player, message)
	if table.find(admins, player.DisplayName) then
		messaging:PublishAsync("Announcements", message)
		if sendWebhook == true then
			local fields = {
				{
					['name'] = "Message",
					['value'] = message,
					['inline'] = true
				},
				
				{
					['name'] = "UserId",
					['value'] = player.DisplayName,
					['inline'] = true
				}
			}
			ws:createEmbed(url, "New Announcement", player.Name .. " Has sent a server announcement", fields)
		end
	end
end)
