How Would I Edit a Players Message?

For example, when the players types “ez”, how would I change it to maybe “gg”? I have a script setup where it detects when the player says “ez”, but now I just need to figure how to actually change the message.

Look at “RegisterFilterMessageFunction” in this developer hub:

Hmm this seems confusing to me, could you write a simple script of this for me? I don’t really understand the article :sweat_smile:

Are you asking if the player types in chat or if a player types in a textbox?

If the player Types a certain message in the chat I would like to change the message :blush:

Here is a slightly modified version of the example on the developer hub page:

-- Paste this example into a ModuleScript within the ChatModules folder.

local functionId = "editText"

local function doFilter(speaker, messageObject, channelName)

    if messageObject.Message == "ez" then
        messageObject.Message = "gg"
local function runChatModule(ChatService)
	ChatService:RegisterFilterMessageFunction(functionId, doFilter)
return runChatModule

I have not tested this, but this is the sort of method you could use to accomplish your goal.

Here is an article on the hyarchy of the ChatService, that should also be of help.


Thank you! This worked!!! :smiley::smiley::smiley::smiley:

1 Like