Global Announcement System - Source code

Server Script:

local MessagingService = game:GetService("MessagingService")
local ReplicatedStorage =  game:GetService("ReplicatedStorage")

local Notification = ReplicatedStorage.AnnounceSystem:WaitForChild("Notification")

local FirstCommand = "/announce"

local Admin = "Cookie_DevX"


game.Players.PlayerAdded:Connect(function(Player)
	if Player.Name == Admin then 
		Player.Chatted:Connect(function(Msg)
			local Split_Message = Msg:split(" ")
			if Split_Message[1] == FirstCommand then
				MessagingService:PublishAsync("Global_Announcement", Msg:gsub(Split_Message[1], ""))
				Notification:FireClient(Player, "Success!","Your message has successfully been sent out.")
			end
		end)
	end
end)

MessagingService:SubscribeAsync("Global_Announcement",function(message)
	Notification:FireAllClients("Global Announcement", message["Data"])
end)

Local script:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local StarterGui = game:GetService("StarterGui")

local Notification = ReplicatedStorage.AnnounceSystem:WaitForChild("Notification")


Notification.OnClientEvent:Connect(function(Title, Description)
	StarterGui:SetCore("SendNotification", 
		{
			Title = Title,
			Text = Description
		}
	)
end)

This topic was automatically closed 1 minute after the last reply. New replies are no longer allowed.