Use RegisterFilterMessageFunction to change a player’s chat message.
Example code: (Paste this into a ModuleScript within the ChatModules folder.)
local functionId = "editText"
local function doFilter(speaker, messageObject, channelName)
if messageObject.Message == "ez" then
messageObject.Message = "gg"
end
end
local function runChatModule(ChatService)
ChatService:RegisterFilterMessageFunction(functionId, doFilter)
end
return runChatModule
This changes a player’s message from “ez” to “gg”.
DevHub link: Lua Chat System — Server API — ChatService
Another post for more info: How Would I Edit a Players Message?