TextChannel

Show Deprecated

Represents a text chat channel.

Contains TextSources as descendants.

To send a chat message to the TextChannel, call TextChannel:SendAsync() from a LocalScript. The corresponding TextSource of the user with TextSource.CanSend = true must be in that channel.

Summary

Properties

Events


Fires when a TextChannel:SendAsync() response is received by the server or TextChannel:DisplaySystemMessage() is invoked.

Methods

DisplaySystemMessage(systemMessage: string, metadata: string): TextChatMessage  

Displays a system message to the user.

AddUserAsync(userId: number): Tuple  YIELDS

Adds a TextSource to the TextChannel given userId of a Player.

SendAsync(message: string, metadata: string): TextChatMessage  YIELDS

Sends a TextChatMessage to the server.

Callbacks

Properties

Events

MessageReceived

Fires when a TextChannel:SendAsync() response is received by the server or TextChannel:DisplaySystemMessage() is invoked.

Use TextChatMessage parameter to get the TextSource and the text of the message (with TextChatMessage.Text).

The TextChatMessage parameter can be mutated by any functions bound to TextChatMessage.OnIncomingMessage and TextChannel.OnIncomingMessage.

Parameters

incomingMessage: TextChatMessage

The received TextChatMessage.


Methods

DisplaySystemMessage

Displays a system message to user. This can only be used in a LocalScript. Messages are only visible to that user and are not automatically filtered or localized.

Parameters

systemMessage: string

The system message sent to the TextChannel.

metadata: string

Used to identify system message types, such as the default system messages.

Default Value: ""

Returns

A TextChatMessage with TextChatMessage.Status property that indicates the condition of the message.

AddUserAsync

Yields

Adds a TextSource to the TextChannel given userId of the user (with Player.UserId).

This can only be used in a Script.

If a TextSource representing the user does not exist, this adds a TextSource.

If a 'TextSourcerepresenting the user does exist, this returns theClass.TextSource`.

If the user has chat off or isn't in the server, this returns a tuple nil, false.

Parameters

userId: number

The userId of the Player.


Returns

Returns TextSource and true if a new TextSource is created for the user, TextSource and false if there is an existing TextSource, or nil and false if the user has chat off or is not in this server.

Yields

Sends a TextChatMessage to the server. This can only be used in a LocalScript.

Parameters

message: string

The message to send to the TextChannel.

metadata: string

Custom metadata to attach to the message.

Default Value: ""

Returns

A TextChatMessage with TextChatMessage.Status property that indicates the condition of the message.

Callbacks

OnIncomingMessage

Parameters


Returns