Roblox BubbleChat Autocorrection Implementation

Hello! I wrote a simple function that automatically autocorrects a string;

local function AutoCorrect(s: string) --> "hello" 
	local newString = string.sub(s, 1, 1):upper() .. string.sub(s, 2) .. "."
	return newString --> "Hello." 
end

Now my question is, how would I implement this into the bubblechat system, so that when you send a message in chat, it will automatically autocorrect that message. I have no idea where to place this function and where to use it as I have alot of difficulty reading the Roblox Bubblechat Script.

1 Like

Does not solve your topic but this is not an auto correct.

Unfortunatelly, I don’t think this is possible on Roblox’s chat. You have to write a custom chat system, listen for the message they are trying to send, edit it and send it.

Edit: With a little researching, I saw I was wrong.

I have read thru the forum post, however I am unable to find a solution to my specific problem.

You should do checks to make sure you aren’t messing up the string. Eg if the user inputted a word that ended with a full stop, would you still want to put a full stop at the end?

Why wouldnt you just edit the code? It already gives you the envoirment to do it.

local function Run(ChatService)

	local function ReverseTheChatMsgFilterFunction(speakerName, messageObj, channelName)
		local msgTxt = messageObj.Message
		msgTxt = string.sub(msgTxt , 1, 1):upper() .. string.sub(msgTxt, 2) .. "."
		messageObj.Message = msgTxt
	end

	ChatService:RegisterFilterMessageFunction("ReverseChatMsg", ReverseTheChatMsgFilterFunction)

end

return Run

It seems to be working well.

I’m talking about BubbleChat my man. I already have this for the normal chat.