TextChatService.OnIncomingMessage is printing twice. Why?

For some reason the message gets printed twice and I don’t know how to fix this. I printed Message.Status and it shows:

18:59:51.900 Enum.TextChatMessageStatus.Sending - Client - PlayerHandler:264
18:59:51.986 Enum.TextChatMessageStatus.Success - Client - PlayerHandler:264

function WitchTyped(msg)
	print(msg)
	local FilteredMessage = msg:lower():gsub("\r","")
end


game:GetService("TextChatService").OnIncomingMessage = function(Message)
	print(Message.Status)
	WitchTyped(Message.Text)
end

Try checking if the Status is Success, and if it is, print the message.

2 Likes

So I tried this and this:

TextChatService.OnIncomingMessage = function(Message)

	if Message.Status.EnumType == Enum.TextChatMessageStatus.Success then
	print(Message.Status)

	WitchTyped(Message.Text)
	end
end

and it does not print the message

Remove the EnumType from the if check

if Message.Status == Enum.TextChatMessageStatus.Success then
5 Likes

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