TextChatService

사용되지 않는 항목 표시
만들 수 없음
서비스

A service handling in-experience text chat, including managing channels, decorating messages, filtering text, creating commands, and developing custom chats interfaces.

To learn more, see In-Experience Text Chat.

요약

속성

메서드

이벤트

속성

ChatTranslationEnabled

복제되지 않음
병렬 읽기
roblox 스크립트 보안

ChatVersion

병렬 읽기
액세스할 수 없는 보안

Determines whether to fully enable TextChatService or revert to the legacy chat system. Setting this property to Enum.ChatVersion.LegacyChatService effectively disables TextChatService.

CreateDefaultCommands

병렬 읽기
플러그인 보안

Determines whether TextChatService should create default TextChatCommands.

If true, the following TextChatCommands are created and put in a Folder named TextChatCommands inside TextChatService:

NamePrimary AliasSecondary AliasDescriptionUsage Example
RBXClearCommandclearclsClears the chat log for the local user./cls
RBXConsoleCommandconsoleOpens the Developer Console./console
RBXEmoteCommandemoteePlays an avatar emote./e dance
RBXHelpCommandhelp?Shows a list of chat commands./help
RBXMuteCommandmutemMutes a user by their Name or DisplayName in all TextChannels./m Username
RBXTeamCommandteamtEnters team chat mode where messages are only visible to teammates./t
RBXUnmuteCommandunmuteumUnmutes a user by their Name or DisplayName in all TextChannels./um Username
RBXVersionCommandversionvShows the chat version./version
RBXWhisperCommandwhisperwEnters whisper mode with another Player./w DisplayName or /w @Username

Note that you can edit, create, and remove TextChatCommands even if CreateDefaultCommands is true. Also note that mute and unmute commands apply to all TextChannels.

CreateDefaultTextChannels

병렬 읽기
플러그인 보안

Determines whether TextChatService should create default TextChannels. If true, a Folder named TextChannels is created inside TextChatService at runtime to contain the TextChannels outlined in the table below. Each of the default channels has the described special behavior applied to messages using its internally bound TextChannel.OnIncomingMessage callback function, changing how messages appear when sent through the channel. The callback is assigned automatically either at runtime (if the TextChannel exists) or when the TextChannel is created.

ChannelDescription
RBXGeneralTextChannel for player messages. In the chat window, messages are modified such that PrefixText receives a rich text font color tag to give chatting players their distinctive name color. If Player.Team exists, that Team.TeamColor is used instead of the default name color.
RBXSystemTextChannel for system messages. In the chat window, messages are modified such that TextChatMessage.Text is given a light grey color tag by default, or a red color tag if TextChatMessage.Metadata contains the word "Error".
RBXTeam[BrickColor]TextChannel for team-specific player messages, created when a TeamColor is in use by any Team within the Teams service. Name of the created channel is RBXTeam followed by the TeamColor name. For example, RBXTeamCrimson is a TextChannel created when there is an active team whose TeamColor property is the "Crimson" BrickColor.

In the chat window, messages are modified such that PrefixText is colored according to the TeamColor and is prepended with [Team].

Team channels create TextSources for all non‑Neutral players with the matching TeamColor, allowing them to use team‑only chat. Channels are removed if there are no remaining teams with an associated TeamColor.
RBXWhisper:[UserId1]_[UserId2]TextChannel for whisper messages between two players, created when a player uses the /whisper command on another player. For example RBXWhisper:2276836_505306092 is a TextChannel for players with UserIds2276836 and 505306092. Inside whisper channels are two TextSources associated with the respective UserIds.

In the chat window, messages are colored the same as those in RBXGeneral and TextChatMessage.PrefixText is modified to show whether a message was sent from or received by the local user.

Whisper channels are removed when either player leaves the experience.

Note that the default TextChannel.OnIncomingMessage callbacks can be overwritten. Also note that you can edit, create, and remove TextChannels even if CreateDefaultTextChannels is true.

메서드

DisplayBubble

void

Displays a chat bubble above the provided part or player character, and fires the BubbleDisplayed event with the parameters specified in this method. Can display bubbles for non-player characters (NPCs) if you specify a part within the character, such as its head.

매개 변수

partOrCharacter: Instance

The part or character that the bubble to be displayed above.

message: string

The text to be displayed in the chat bubble.


반환

void

CanUserChatAsync

생성

매개 변수

userId: number

반환

CanUsersChatAsync

생성

매개 변수

userIdFrom: number
userIdTo: number

반환

이벤트

BubbleDisplayed

Fires when TextChatService:DisplayBubble() is called.

매개 변수

partOrCharacter: Instance
textChatMessage: TextChatMessage

MessageReceived

Like TextChannel.MessageReceived, fires when TextChannel:DisplaySystemMessage() is invoked on the client, or when the client receives a valid TextChannel:SendAsync() response from the server. This event is only fired on the client.

If the server's TextChannel.ShouldDeliverCallback property is bound and returns false, the client will not fire TextChatService.MessageReceived.

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

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

매개 변수

textChatMessage: TextChatMessage

The received TextChatMessage.


SendingMessage

Fires when TextChannel:SendAsync() is called by the sending client. Use this to allow placeholder messages to be shown to the user while waiting for server response to TextChannel:SendAsync().

매개 변수

textChatMessage: TextChatMessage

OnBubbleAdded

매개 변수

adornee: Instance

반환

OnIncomingMessage

매개 변수


반환