# TextChatService（ロブロックス クラス）

> A service handling in-experience text chat.

- URL：https://roblox.minecraft-okinawa.com/reference/classes/TextChatService/
- 公式：https://create.roblox.com/docs/reference/engine/classes/TextChatService
- 受け継いでいるクラス：Instance

## プロパティ

- `TextChatService.ChatTranslationEnabled: boolean`：Determines whether a user has chat translation enabled.
- `TextChatService.CreateDefaultCommands: boolean`：Determines whether TextChatService should create default Class.TextChatCommand|TextChatCommands.
- `TextChatService.CreateDefaultTextChannels: boolean`：Determines whether TextChatService should create default Class.TextChannel|TextChannels.

## メソッド

- `TextChatService:CanUserChatAsync(userId: User): boolean`：Determines whether a user has permission to chat in experiences.
- `TextChatService:CanUsersChatAsync(userIdFrom: User, userIdTo: User): boolean`：Determines whether or not two users can receive messages from each other.
- `TextChatService:CanUsersDirectChatAsync(requesterUserId: User, userIds: Array): Array`：Determines whether a user has permission to chat directly with other users in experiences based on factors such as their parental control settings.
- `TextChatService:DisplayBubble(partOrCharacter: Instance, message: string): ()`：Displays a chat bubble above the provided part or player character.
- `TextChatService:GetChatGroupsAsync(players: Instances): Array`：Returns chat group IDs that indicate which players can synchronously text chat together.

## イベント

- `TextChatService.BubbleDisplayed(partOrCharacter: Instance, textChatMessage: TextChatMessage)`：Fires when Class.TextChatService:DisplayBubble() is called.
- `TextChatService.MessageReceived(textChatMessage: TextChatMessage)`：Fires when Class.TextChannel:DisplaySystemMessage() is invoked on the client, or when the client receives a valid Class.TextChannel:SendAsync() response from the server.
- `TextChatService.SendingMessage(textChatMessage: TextChatMessage)`：Fires when Class.TextChannel:SendAsync() is called by the sending client.

## コールバック

- `TextChatService:OnBubbleAdded(message: TextChatMessage, adornee: Instance): Tuple`：Called when a bubble chat is about to be displayed.
- `TextChatService:OnChatWindowAdded(message: TextChatMessage): Tuple`：Called when a new message is about to be displayed in the chat window. This can only be implemented on the client.
- `TextChatService:OnIncomingMessage(message: TextChatMessage): Tuple`：Called when TextChatService is receiving an incoming message.

英語の説明とメンバー一覧：Roblox Creator Documentation（CC BY 4.0）。日本語の解説はこのサイト独自のものです。

執筆：鈴木孝昌（現役プロジェクトマネージャー／プログラミング講師）／運営：沖縄マイクラ部 プログラミングスクール「クロスウェーブ」（https://minecraft-okinawa.com/）