Er1x_Official

Custom Chat Server Script

May 8th, 2022
970
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.50 KB | None | 0 0
  1. local chat = game:GetService("Chat")
  2. local rep = game:GetService("ReplicatedStorage")
  3. local event = rep:WaitForChild("Chatted")
  4.  
  5. local format = "[%s]: %s"
  6. event.OnServerEvent:Connect(function(Player,String)
  7.     if typeof(String) == "string" then -- check if string
  8.         local bool,result = pcall(function()
  9.             return chat:FilterStringForBroadcast(String,Player) -- filter
  10.         end)
  11.        
  12.         if bool then
  13.             event:FireAllClients(string.format(format,Player.Name,result)) -- send filtred string
  14.         end
  15.     end
  16. end)
Advertisement
Add Comment
Please, Sign In to add comment