# Chat

Roblox Engine API class from Roblox Studio 0.744.0.7441077 (version-7aaa6838d36c4448).

- Inherits from, nearest first: [Instance](https://rapi.sleaze.dev/classes/Instance.md), [Object](https://rapi.sleaze.dev/classes/Object.md)
- Tags: Not creatable, Not replicated, Service
- Memory category: Instances
- HTML page: https://rapi.sleaze.dev/classes/Chat/
- Roblox documentation: https://create.roblox.com/docs/reference/engine/classes/Chat

Houses the Luau code responsible for running the legacy chat system.

## Properties

### BubbleChatEnabled

```luau
Chat.BubbleChatEnabled: boolean = false
```

- Tags: Read capabilities: Chat

Determines whether player's chat messages will appear above their in-game avatar.

### LoadDefaultChat

```luau
Chat.LoadDefaultChat: boolean = true
```

- Tags: Write: Not accessible, Read capabilities: Chat

Toggles whether the default chat framework should be automatically loaded when the game runs.

### IsAutoMigrated

```luau
Chat.IsAutoMigrated: boolean = false
```

- Tags: Hidden, Roblox script security, Read capabilities: Chat

### ModerationMode

```luau
Chat.ModerationMode: string = "Unsupported"
```

- Tags: Hidden, Not replicated, Roblox script security, Read capabilities: Chat

## Methods

### CanUserChatAsync

```luau
Chat:CanUserChatAsync(userId: number): boolean
```

- Tags: Yields, Capabilities: Chat

Will return false if the player with the specified [`Player.UserId`](https://rapi.sleaze.dev/classes/Player.md) is not allowed to chat because of their account settings.

### CanUsersChatAsync

```luau
Chat:CanUsersChatAsync(userIdFrom: number, userIdTo: number): boolean
```

- Tags: Yields, Capabilities: Chat

Will return false if the two users cannot communicate because their account settings do not allow it.

### Chat

```luau
Chat:Chat(partOrCharacter: Instance, message: string, color: Enum.ChatColor? = Enum.ChatColor.Blue)
```

- Tags: Capabilities: Chat

Fires the [`Chat.Chatted`](https://rapi.sleaze.dev/classes/Chat.md) event with the parameters specified in this method.

Parameters:

- `partOrCharacter`: An instance that is the part or character which the *BubbleChat* dialog should appear above.
- `message`: The message string being chatted.
- `color`: An `ChatColor` specifying the color of the chatted message.

### ChatLocal

```luau
Chat:ChatLocal(partOrCharacter: Instance, message: string, color: Enum.ChatColor? = Enum.ChatColor.Blue)
```

- Tags: Roblox script security, Capabilities: Chat

### FilterStringAsync

```luau
Chat:FilterStringAsync(stringToFilter: string, playerFrom: Player, playerTo: Player): string
```

- Tags: Yields, Capabilities: Chat

Filters a string sent from a player to another player using filtering that is appropriate to the players' account settings.

Parameters:

- `stringToFilter`: The raw string to be filtered, exactly as entered by the player.
- `playerFrom`: The author of the text.
- `playerTo`: The intended recipient of the provided text; use the author if the text is persistent (see description).

### FilterStringForBroadcast

```luau
Chat:FilterStringForBroadcast(stringToFilter: string, playerFrom: Player): string
```

- Tags: Yields, Capabilities: Chat

Filters a string sent from a player meant for broadcast to no particular target. More restrictive than [`Chat:FilterStringAsync()`](https://rapi.sleaze.dev/classes/Chat.md).

Parameters:

- `stringToFilter`: Message string being filtered.
- `playerFrom`: Instance of the player sending the message.

Returns: Filtered message string.

### GetShouldUseLuaChat

```luau
Chat:GetShouldUseLuaChat(): boolean
```

- Tags: Roblox script security, Capabilities: Chat

### InvokeChatCallback

```luau
Chat:InvokeChatCallback(callbackType: Enum.ChatCallbackType, ...: any): ...any
```

- Tags: Capabilities: Chat

Invoke a chat callback function registered by [`RegisterChatCallback`](https://rapi.sleaze.dev/classes/Chat.md). Used by the Luau Chat System.

Parameters:

- `callbackType`: The type of callback to invoke.
- `callbackArguments`: The arguments that will be sent to the registered callback function.

Returns: The values returned by the function registered to the given ChatCallbackType.

### ReconcileCommunicationAccess

```luau
Chat:ReconcileCommunicationAccess()
```

- Tags: Roblox script security, Capabilities: Chat

### RegisterChatCallback

```luau
Chat:RegisterChatCallback(callbackType: Enum.ChatCallbackType, callbackFunction: (...any) -> ...any)
```

- Tags: Capabilities: Chat

Register a function to be called upon the invocation of some chat system event ([`InvokeChatCallback`](https://rapi.sleaze.dev/classes/Chat.md)).

Parameters:

- `callbackType`: The callback to which the function shall be registered (this determines in what way the function is called).
- `callbackFunction`: The function to call when the callback is invoked using Chat:InvokeChatCallback.

### RequestModerationModeEnabled

```luau
Chat:RequestModerationModeEnabled(enabled: boolean)
```

- Tags: Roblox script security, Capabilities: Chat

### SetBubbleChatSettings

```luau
Chat:SetBubbleChatSettings(settings: any)
```

- Tags: Capabilities: Chat

Customizes various settings of the in-game bubble chat.

Parameters:

- `settings`: A settings table.

### FilterStringForPlayerAsync

```luau
Chat:FilterStringForPlayerAsync(stringToFilter: string, playerToFilterFor: Player): string
```

- Tags: Deprecated, Yields, Capabilities: Chat
- Use instead: [`Chat.FilterStringAsync`](https://rapi.sleaze.dev/classes/Chat.md)

**Deprecated:** This item has been superseded by [`Chat:FilterStringAsync()`](https://rapi.sleaze.dev/classes/Chat.md) and [`Chat:FilterStringForBroadcast()`](https://rapi.sleaze.dev/classes/Chat.md) which should be used in all new work

Filters a string appropriate to the given player's age settings, so they see what is appropriate to them.

Parameters:

- `stringToFilter`: String being filtered.
- `playerToFilterFor`: Player that the string is being filtered for.

Returns: Filtered string result.

## Events

### BubbleChatSettingsChanged

```luau
Chat.BubbleChatSettingsChanged: RBXScriptSignal<(settings: any)>
```

- Tags: Roblox script security, Capabilities: Chat

### Chatted

```luau
Chat.Chatted: RBXScriptSignal<(part: Instance, message: string, color: Enum.ChatColor)>
```

- Tags: Capabilities: Chat

Fires when [`Chat:Chat()`](https://rapi.sleaze.dev/classes/Chat.md) is called.

### ClientToServerFilterMessageSignalV2

```luau
Chat.ClientToServerFilterMessageSignalV2: RBXScriptSignal<(sender: Instance, receiver: Instance, unfilteredMessage: string)>
```

- Tags: Hidden, Roblox engine security, Capabilities: Chat

### ClientToServerReportUnfilteredSignal

```luau
Chat.ClientToServerReportUnfilteredSignal: RBXScriptSignal<(unfilteredText: string, match: string, instancePath: string, instanceType: string)>
```

- Tags: Hidden, Roblox engine security, Capabilities: Chat

### ModerationModeEnabledChanged

```luau
Chat.ModerationModeEnabledChanged: RBXScriptSignal<(enabled: boolean)>
```

- Tags: Hidden, Roblox engine security, Capabilities: Chat

### PlayerChatAvailabilityStatusChanged

```luau
Chat.PlayerChatAvailabilityStatusChanged: RBXScriptSignal<(player: Player)>
```

- Tags: Roblox engine security, Capabilities: Chat

### ReconcileCommunicationAccessCompleted

```luau
Chat.ReconcileCommunicationAccessCompleted: RBXScriptSignal<(chatAvailabilityStatus: string)>
```

- Tags: Roblox script security, Capabilities: Chat

### ReconcileCommunicationAccessSignal

```luau
Chat.ReconcileCommunicationAccessSignal: RBXScriptSignal<()>
```

- Tags: Hidden, Roblox engine security, Capabilities: Chat

### ServerToClientUnderOver13FilteredResponseSignal

```luau
Chat.ServerToClientUnderOver13FilteredResponseSignal: RBXScriptSignal<(sender: Instance, unfilteredMessage: string, isError: boolean, errorStr: string, under13: string, over13: string)>
```

- Tags: Hidden, Roblox engine security, Capabilities: Chat

### TimeoutChatAttempt

```luau
Chat.TimeoutChatAttempt: RBXScriptSignal<(isPermanentTimeout: boolean, endTime: number)>
```

- Tags: Roblox script security, Capabilities: Chat

## Inherited members

- From [Instance](https://rapi.sleaze.dev/classes/Instance.md): `Archivable`, `archivable`, `Attributes`, `AttributesReplicate`, `AttributesSerialize`, `HistoryId`, `Name`, `Parent`, `PredictionMode`, `PropertyStatusStudio`, `RobloxLocked`, `SerializedOverrides`, `SourceAssetId`, `Tags`, `UniqueId`, `numExpectedDirectChildren`, `DataCost`, `Capabilities`, `DefinesCapabilities`, `IsInSandbox`, `Sandboxed`, `AddTag`, `ClearAllChildren`, `Clone`, `Destroy`, `FindFirstAncestor`, `FindFirstAncestorOfClass`, `FindFirstAncestorWhichIsA`, `FindFirstChild`, `FindFirstChildOfClass`, `FindFirstChildWhichIsA`, `FindFirstDescendant`, `GetActor`, `GetAttribute`, `GetAttributeChangedSignal`, `GetAttributes`, `GetChildren`, `GetDebugId`, `GetDescendants`, `GetFullName`, `GetStyled`, `GetStyledPropertyChangedSignal`, `GetTags`, `HasTag`, `IsAncestorOf`, `IsDescendantOf`, `IsPropertyModified`, `QueryDescendants`, `RemoveTag`, `ResetPropertyToDefault`, `SetAttribute`, `WaitForChild`, `Remove`, `children`, `clone`, `destroy`, `findFirstChild`, `getChildren`, `isDescendantOf`, `remove`, `AncestryChanged`, `AttributeChanged`, `ChildAdded`, `ChildRemoved`, `DescendantAdded`, `DescendantRemoving`, `Destroying`, `StyledPropertiesChanged`, `childAdded`
- From [Object](https://rapi.sleaze.dev/classes/Object.md): `ClassName`, `className`, `GetPropertyChangedSignal`, `IsA`, `isA`, `Changed`
