Grammar on messages in chat and in bubblechat

I have seen in some games where when you write a message the grammar gets fixed a bit example:
instead of hello world it’s Hello world.

Can someone help me to do something like that?

1 Like
local message = 'hi'
print(message:gsub("^%l", string.upper))

That should do the trick.

I mean like if you type a message in the chat that it makes the letter at the start uppercase and puts a . at the end of the message but for bubblechat and the chat. I’m not the best scripter so could you explain how to actually use it and where to use it like where to put the script?

Copy all chat modules inside Chat (when you join a game).
After that, stop the game, put them all in Chat.
Make a ModuleScript inside the ChatModules folder.
Put this inside the module:

local functionId = "editText"

function upperstr(str)
    return (str:gsub("^%l", string.upper))

local function doFilter(speaker, messageObject, channelName)
       local upperedString = upperstr(messageObject.Message).."."
       messageObject.Message = upperedString
local function runChatModule(ChatService)
	ChatService:RegisterFilterMessageFunction(functionId, doFilter)
return runChatModule

It works thank you so much for you help.