HELP | how to CHANGE chat text to something ELSE?

local TextChatService = game:GetService("TextChatService")
local rbxGeneralChannel = TextChatService:WaitForChild("TextChannels"):WaitForChild("RBXGeneral")

TextChatService.SendingMessage:Connect(function(textChatMessage)
	local textChatMsgProperties = Instance.new("TextChatMessageProperties")
	print(textChatMessage.Text)
	
	if textChatMessage.Text == "hi" then
		textChatMsgProperties.Text = "bye"
	end

	if textChatMessage.TextChannel == rbxGeneralChannel and #textChatMessage.Text > 0 then
		textChatMsgProperties.Text = textChatMessage.Text .." [added]"
	end
	return textChatMsgProperties
end)

i want TO CHANGE some text from ‘hi’ to ‘bye’ and show it on both CHAT and BUBBLEchat and for everyone

I dont get it, you want to edit msg when player sends “hi” to “bye” or you want to send a msg “bye” when player sends “hi”?

1 Like

You are probably looking for TextChatService.OnIncomingMessage instead of TextChatService.SendingMessage

I’m currently in the middle of improving this documentation to make this more clear. Let me know if this works better

TextChatService.OnIncomingMessage = function(textChatMessage)
	local textChatMsgProperties = Instance.new("TextChatMessageProperties")
	print(textChatMessage.Text)
	
	if textChatMessage.Text == "hi" then
		textChatMsgProperties.Text = "bye"
	end

	if textChatMessage.TextChannel == rbxGeneralChannel and #textChatMessage.Text > 0 then
		textChatMsgProperties.Text = textChatMessage.Text .." [added]"
	end
	return textChatMsgProperties
end

1 Like

THANKS

but i noticed this problem
image

not only does it not change the text, but it adds the string [added]
[place is not published, if that matters]

hi, i still havent manged to solve this

do u have a fix?

“[added]” is being added because of these lines which were present in your OP:

if textChatMessage.TextChannel == rbxGeneralChannel and #textChatMessage.Text > 0 then
	textChatMsgProperties.Text = textChatMessage.Text .." [added]"
end

remove these lines and it will go away

1 Like

thank you, it works

characters

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.