Event description for TextChatService.MessageReceived is wrong

  • The description says that TextChatService.MessageReceived is “only fired on the receiving client when the server … invokes TextChannel:DisplaySystemMessage()”:
    image

  • Testing reveals that this event is fired when the client invokes TextChannel:DisplaySystemMessage():

    Client MessageReceived demo.rbxm (1.3 KB)

  • Additionally, TextChannel:DisplaySystemMessage() has documentation which says that it “can only be used in a LocalScript”:




    (presumably they mean any client script, since Scripts now have a RunContext property)

This is important because the incorrect description makes two mistakes here:

  1. It implies that the client’s TextChatService.MessageReceived event isn’t fired when DisplaySystemMessage is called on that same client

    • only fired when the server invokes DisplaySystemMessage

  2. It says that the server can call TextChannel:DisplaySystemMessage()

It should also be noted that TextChatService.MessageReceived only works on the client. If you try to use it on the server, it doesn’t error, but rather just does nothing in the same way that using RemoteEvent.OnClientEvent on the server does nothing.

A better intro sentence for this event might read: “This event is exclusively fired on the client; it is triggered when either TextChannel:DisplaySystemMessage() is invoked or when the client receives a response from the server after calling TextChannel:SendAsync().”

Lastly, the final sentence in the description reads:


The callback function TextChatMessage.OnIncomingMessage does not exist, and I believe the author meant to write TextChatService.OnIncomingMessage.

Page URL: https://create.roblox.com/docs/reference/engine/classes/TextChannel#MessageReceived

1 Like

See, this would also be incorrect because the server does not call SendAsync, it recieves calls of SendAsync and forwards them onto each client. Also, I do not believe the text in its current writing is ‘misleading’; it’s simply a matter of how you read it.

1 Like

I disagree; if the meaning changes because of how you read it, then it seems like it could use some rewriting — even if that means separating it out into simpler clauses. Additionally, I think the fact that I had to test these behaviors so I could understand is proof enough of its ambiguity.

I also didn’t intend to imply that the server calls SendAsync, and while I think my version is clearer than the original, you are correct it could be workshopped a little.

the client receives a response from the server after calling TextChannel:SendAsync()

The idea here is that the client calls SendAsync, and then receives a response from the server.

Perhaps this is directionally better, although it sounds awkward:

This event is exclusively fired on the client. There are two actions that trigger it:

  1. The method TextChannel:DisplaySystemMessage() is invoked
  2. The client invokes TextChannel:SendAsync() and then receives a response from the server

Thanks for the report! I filed a ticket in our internal database.

1 Like

Hi there,
Thanks for the detailed report on this. I’ve resolved what I believe is everything you reported, but please check carefully and confirm, as there are several subtle phrasing aspects which I want to make sure I’ve resolved before I close our internal ticket.

Best regards,
IgnisRBX

1 Like

Thank you for the response. Like you said, the details are subtle and require close inspection to get it right here. Going by the links you posted, the revised version of MessageReceived on the TextChatService page is clearer than the old version still active on the TextChannel page. At the risk of sounding nitpicky though, there’s still some ambiguity here:

Fires exclusively on the client when […]

When the sentence starts out like this, it gives the reader the impression that there is going to be a follow-up ‘when’ case in which it’s fired in a context other than ‘exclusively on the client.’ The reader may read those first words and then predict the sentence like so:

“Fires exclusively on the client when X, but when Y happens it could be fired differently like on the client and server or exclusively on the server when Z happens blah blah blah”

This is why I originally separated it into two clauses — there’s no ambiguity even though it does sound awkwardly short:

Maybe this is better:

This event is exclusively fired on the client, and is triggered by two actions: […]


There's one other nitpick about the sentence I noticed:

Fires exclusively on the client when a TextChannel:SendAsync() response is received by the server

*by* the server? This preposition is misleading — the client is receiving a response from the server. Yes, the server responds to the client’s TextChannel:SendAsync call, but then the client receives a response back from the server (presumably the server’s role here is through TextChannel.SendDeliverCallback).


The TextChatMessage parameter is the final result of any functions bound to TextChatService.OnIncomingMessage.

I suppose this detail exists for clarity, and it’s a welcome one for me. However, although the TextChatMessage.OnIncomingMessage error mentioned in the OP has been fixed here, it confusingly removes mention of TextChannel.OnIncomingMessage.

The OnIncomingMessage callback exists on both the TextChatService singleton instance and any TextChannel instances in use. From the page In-Experience Text Chat System:

In the top left you can see there’s a box with both of those callbacks inside it. I think it would make sense to include both in the MessageReceived description for consistency.

As a sidenote, testing seems to show that this flowchart is wrong, as the sender’s client fires OnIncomingMessage immediately without waiting for a server response, but perhaps that’s for another thread.


The blurb here in the summary section is even more ambiguous about MessageReceived:

It still has the grammatical ambiguity issues that I described at the start of this post, but it further doesn’t say which context this event is fired on (the client).

Maybe the ‘run context’ ambiguity problem here would be best solved with a more overarching documentation feature, like implementing those green and blue ribbons that the Studio output uses to indicate run context. Here’s an example:

Again though, probably best saved for another thread.


The link at the top of the TextChatService page has a broken link (access denied):

To learn more, see In-Experience Text Chat.


I dunno what HostId is but I’m not taking any chances if it’s sensitive info :P

I figured I would put this here since it’s still the same page in question from the OP, even if it’s not explicitly about MessageReceived.


Again I know these corrections sound petty or minor, but it can be confusing if the technical details are written ambiguously enough to require testing by the reader to ensure he/she read it correctly.

Curious, would you like to collaborate on editing the page through open source? There’s a complete README, and/or you can also click the “EDIT” button on a page if that workflow ends up being a bit easier than going through the VSCode setup.

If you’re interested, give it a try and let me know how it goes… at the end of the day, I’ll be the one reviewing your submission, so I have context on the edits so far.

If you’re not interested, also let me know and we’ll resolve any subtle nuances here instead. :slight_smile:

IgnisRBX

1 Like

I did not know there was an Edit button. I will figure out how to use that and submit an update sometime. Thanks

I applied a couple more edits based on your feedback, which hopefully helps. Feel free to submit more changes through the open source method(s) I mentioned above. :slight_smile:

1 Like

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