Message is printing 2 times, even though I made it to print 1 time only

I was trying to do stuff with new text chat service
I did this:

game:GetService("TextChatService").OnIncomingMessage = function(message)
    print(message["Text"])
end

But the thing is
I chatted these two messages

xd
hi

but it printed 2 times x2 why?
image

1 Like

I also got this kind of print results sometimes, maybe it is bugged or something.

2 Likes

Perhaps for whatever reason the connection is being made twice.

1 Like

I couldn’t seem to print anything even though I was chatting

Do you have the beta feature enabled?

no i dont think so haha i didn’t know this was beta test feature

Hey, thanks for the question.

What looks like is happening here is that the callback is fired twice because technically the TextChatService is receiving “2 messages”, one for the message being sent, and one that is a confirmation from the server.

Do me a favor and try printing the message.Status value to confirm. The first print should read Enum.TextChatMessageStatus.Sending and the second will likely have Enum.TextChatMessage.Success or some error status. But the message.MessageId for both will be the same.

We will certainly document this case to avoid confusion in the future!

4 Likes

Yes, I’ve tried it and its as below;

Sure, thats glad to hear!

Anyways, thanks for the reply from a :roblox_light: staff : )

1 Like