From 5c83a51b275f1fbe01d309ed8a20099e4c9b5c8f Mon Sep 17 00:00:00 2001 From: "rbx-open-source-docs[bot]" <138828531+rbx-open-source-docs[bot]@users.noreply.github.com> Date: Wed, 6 Nov 2024 21:32:46 +0000 Subject: [PATCH] update Open Source Docs from Roblox internal teams --- .../Advanced-Bubble.png | 4 +- .../in-experience-text-chat/Chat-NPC.jpg | 3 + .../Chat-Rich-Text.png | 3 + .../in-experience-text-chat/Chat-System.jpg | 3 + .../in-experience-text-chat/Chat-Tag-VIP.jpg | 3 - .../in-experience-text-chat/Chat-Tag-VIP.png | 3 + .../Chat-User-Name-Colored.png | 3 + .../Chat-User-Name-Gradient.png | 3 + .../Chat-Window-Components.jpg | 3 + .../ChatInputBarConfiguration-Enabled.png | 3 - .../ChatWindowConfiguration-Enabled.png | 3 - .../Text-Custom-Command.mp4 | 4 +- .../TextChatCommand-Aliases.png | 4 +- .../TextChatCommand-SizeCommand.png | 3 - ...ervice-BubbleChatConfiguration-Enabled.png | 4 +- ...extChatService-BubbleChatConfiguration.png | 4 +- .../TextChatService-Configuration-Objects.png | 4 +- ...xtChatService-ChannelTabsConfiguration.png | 3 + ...tChatService-ChatInputBarConfiguration.png | 3 + ...extChatService-ChatWindowConfiguration.png | 3 + .../TextChatService-TextChatCommand.png | 3 + content/en-us/chat/bubble-chat.md | 230 ++++----- .../customizing-in-experience-text-chat.md | 454 ++++++++++++++---- content/en-us/chat/in-experience-text-chat.md | 90 ++-- content/en-us/chat/legacy/admin-commands.md | 2 +- .../classes/ChannelTabsConfiguration.yaml | 92 +++- .../classes/ChatInputBarConfiguration.yaml | 111 ++--- .../classes/ChatWindowConfiguration.yaml | 116 ++--- .../classes/ChatWindowMessageProperties.yaml | 36 +- .../classes/TextChatMessageProperties.yaml | 18 +- .../engine/classes/TextChatService.yaml | 24 +- 31 files changed, 779 insertions(+), 463 deletions(-) create mode 100644 content/en-us/assets/players/in-experience-text-chat/Chat-NPC.jpg create mode 100644 content/en-us/assets/players/in-experience-text-chat/Chat-Rich-Text.png create mode 100644 content/en-us/assets/players/in-experience-text-chat/Chat-System.jpg delete mode 100644 content/en-us/assets/players/in-experience-text-chat/Chat-Tag-VIP.jpg create mode 100644 content/en-us/assets/players/in-experience-text-chat/Chat-Tag-VIP.png create mode 100644 content/en-us/assets/players/in-experience-text-chat/Chat-User-Name-Colored.png create mode 100644 content/en-us/assets/players/in-experience-text-chat/Chat-User-Name-Gradient.png create mode 100644 content/en-us/assets/players/in-experience-text-chat/Chat-Window-Components.jpg delete mode 100644 content/en-us/assets/players/in-experience-text-chat/ChatInputBarConfiguration-Enabled.png delete mode 100644 content/en-us/assets/players/in-experience-text-chat/ChatWindowConfiguration-Enabled.png delete mode 100644 content/en-us/assets/players/in-experience-text-chat/TextChatCommand-SizeCommand.png create mode 100644 content/en-us/assets/studio/explorer/TextChatService-ChannelTabsConfiguration.png create mode 100644 content/en-us/assets/studio/explorer/TextChatService-ChatInputBarConfiguration.png create mode 100644 content/en-us/assets/studio/explorer/TextChatService-ChatWindowConfiguration.png create mode 100644 content/en-us/assets/studio/explorer/TextChatService-TextChatCommand.png diff --git a/content/en-us/assets/players/in-experience-text-chat/Advanced-Bubble.png b/content/en-us/assets/players/in-experience-text-chat/Advanced-Bubble.png index 583e12257..05e41cb6b 100644 --- a/content/en-us/assets/players/in-experience-text-chat/Advanced-Bubble.png +++ b/content/en-us/assets/players/in-experience-text-chat/Advanced-Bubble.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d7dabde16aaf8fd55deb9f173ca080f683a059a0246d1c783fcc9143812b6e92 -size 52970 +oid sha256:a036d05dfa5717252985742577acdec9278f310806cb57156ca837204bc2c4df +size 10514 diff --git a/content/en-us/assets/players/in-experience-text-chat/Chat-NPC.jpg b/content/en-us/assets/players/in-experience-text-chat/Chat-NPC.jpg new file mode 100644 index 000000000..6607cf52e --- /dev/null +++ b/content/en-us/assets/players/in-experience-text-chat/Chat-NPC.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8422afbd75475896f3b4a0b6d5f8803b32964532131e68b7d7b0062f60ff7956 +size 250552 diff --git a/content/en-us/assets/players/in-experience-text-chat/Chat-Rich-Text.png b/content/en-us/assets/players/in-experience-text-chat/Chat-Rich-Text.png new file mode 100644 index 000000000..f14f345d5 --- /dev/null +++ b/content/en-us/assets/players/in-experience-text-chat/Chat-Rich-Text.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:86b21f3aee5810ab9c68ebd4c524f99fa44e60e55f5d3365772d8faea9b0955b +size 251484 diff --git a/content/en-us/assets/players/in-experience-text-chat/Chat-System.jpg b/content/en-us/assets/players/in-experience-text-chat/Chat-System.jpg new file mode 100644 index 000000000..d9dc203ca --- /dev/null +++ b/content/en-us/assets/players/in-experience-text-chat/Chat-System.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:15ac496789a780e0874f112d398bdf6b02635bf9f3bea4a3afdc4387b8cccf23 +size 231735 diff --git a/content/en-us/assets/players/in-experience-text-chat/Chat-Tag-VIP.jpg b/content/en-us/assets/players/in-experience-text-chat/Chat-Tag-VIP.jpg deleted file mode 100644 index 608269d94..000000000 --- a/content/en-us/assets/players/in-experience-text-chat/Chat-Tag-VIP.jpg +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:8b11b3cf1b0b1be637772bc3b27771d8bdcac6ce087e4ed5c9ae93d7ac178958 -size 230728 diff --git a/content/en-us/assets/players/in-experience-text-chat/Chat-Tag-VIP.png b/content/en-us/assets/players/in-experience-text-chat/Chat-Tag-VIP.png new file mode 100644 index 000000000..20182ab94 --- /dev/null +++ b/content/en-us/assets/players/in-experience-text-chat/Chat-Tag-VIP.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:33c10813a18a3054a2bddd4091ea4a76980f5fd40911afb998327b83d452edcd +size 251487 diff --git a/content/en-us/assets/players/in-experience-text-chat/Chat-User-Name-Colored.png b/content/en-us/assets/players/in-experience-text-chat/Chat-User-Name-Colored.png new file mode 100644 index 000000000..c984ef526 --- /dev/null +++ b/content/en-us/assets/players/in-experience-text-chat/Chat-User-Name-Colored.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2862f6c574e10abb288df536a7e0a5350efe24ab14e5b6413845a7b6e7606d52 +size 230282 diff --git a/content/en-us/assets/players/in-experience-text-chat/Chat-User-Name-Gradient.png b/content/en-us/assets/players/in-experience-text-chat/Chat-User-Name-Gradient.png new file mode 100644 index 000000000..9ad2af939 --- /dev/null +++ b/content/en-us/assets/players/in-experience-text-chat/Chat-User-Name-Gradient.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a633b6324b324f12d939b0110e8d4ebc8fea011a92a7222e5a4c4e54cc1bcfcc +size 232839 diff --git a/content/en-us/assets/players/in-experience-text-chat/Chat-Window-Components.jpg b/content/en-us/assets/players/in-experience-text-chat/Chat-Window-Components.jpg new file mode 100644 index 000000000..3939549c4 --- /dev/null +++ b/content/en-us/assets/players/in-experience-text-chat/Chat-Window-Components.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:98be9c89dc12400576e655adebab347153195f28c7df47183b3d23cb27110755 +size 274819 diff --git a/content/en-us/assets/players/in-experience-text-chat/ChatInputBarConfiguration-Enabled.png b/content/en-us/assets/players/in-experience-text-chat/ChatInputBarConfiguration-Enabled.png deleted file mode 100644 index 51e5878d6..000000000 --- a/content/en-us/assets/players/in-experience-text-chat/ChatInputBarConfiguration-Enabled.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:0e8ba6bdd44038aaecd24e8e0497aed0c21376e8ec24b5b27065059f9b246f82 -size 25181 diff --git a/content/en-us/assets/players/in-experience-text-chat/ChatWindowConfiguration-Enabled.png b/content/en-us/assets/players/in-experience-text-chat/ChatWindowConfiguration-Enabled.png deleted file mode 100644 index 7683842e5..000000000 --- a/content/en-us/assets/players/in-experience-text-chat/ChatWindowConfiguration-Enabled.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:bdbc1343e55594477a409a51e5974146e486a087c3df0ec7c820411d37fb5ed4 -size 28296 diff --git a/content/en-us/assets/players/in-experience-text-chat/Text-Custom-Command.mp4 b/content/en-us/assets/players/in-experience-text-chat/Text-Custom-Command.mp4 index 4609b73b0..fb9527b69 100644 --- a/content/en-us/assets/players/in-experience-text-chat/Text-Custom-Command.mp4 +++ b/content/en-us/assets/players/in-experience-text-chat/Text-Custom-Command.mp4 @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d1e4cd418e53158e2443d69fa83e45d643d6f311f10199e90f333fe495e02600 -size 7412273 +oid sha256:6faa303624dd33286ab611dfd66e2f70b2f434e425738a4541fe0b6fca1ae0a9 +size 7853155 diff --git a/content/en-us/assets/players/in-experience-text-chat/TextChatCommand-Aliases.png b/content/en-us/assets/players/in-experience-text-chat/TextChatCommand-Aliases.png index 0d0781633..f8f02d206 100644 --- a/content/en-us/assets/players/in-experience-text-chat/TextChatCommand-Aliases.png +++ b/content/en-us/assets/players/in-experience-text-chat/TextChatCommand-Aliases.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8a10c4c8d9a01a5a2c3caea2ccd0ac508926483954b23f3e358ae2756f214606 -size 35616 +oid sha256:e9cc6d8f1bb2ebb900204d433c0585296b663a6ed623a212fda324d481ce2f84 +size 52271 diff --git a/content/en-us/assets/players/in-experience-text-chat/TextChatCommand-SizeCommand.png b/content/en-us/assets/players/in-experience-text-chat/TextChatCommand-SizeCommand.png deleted file mode 100644 index 54367498a..000000000 --- a/content/en-us/assets/players/in-experience-text-chat/TextChatCommand-SizeCommand.png +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b36fc1fca933cc2b2dc2cb95a191d3c045a30eaa62f74e8eec83d637e2118ba9 -size 18421 diff --git a/content/en-us/assets/players/in-experience-text-chat/TextChatService-BubbleChatConfiguration-Enabled.png b/content/en-us/assets/players/in-experience-text-chat/TextChatService-BubbleChatConfiguration-Enabled.png index 6fa779b02..c26eda87b 100644 --- a/content/en-us/assets/players/in-experience-text-chat/TextChatService-BubbleChatConfiguration-Enabled.png +++ b/content/en-us/assets/players/in-experience-text-chat/TextChatService-BubbleChatConfiguration-Enabled.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b9e80f6e9553a74061eb4227fc115946a88d3b9d601b7e989a149ba4d0e41063 -size 36005 +oid sha256:e548efaeadc48b8e8c63d3ef6ea4ef52f8fa3210d4c068cc658cc430647e8d41 +size 53906 diff --git a/content/en-us/assets/players/in-experience-text-chat/TextChatService-BubbleChatConfiguration.png b/content/en-us/assets/players/in-experience-text-chat/TextChatService-BubbleChatConfiguration.png index 8a409922e..40360a801 100644 --- a/content/en-us/assets/players/in-experience-text-chat/TextChatService-BubbleChatConfiguration.png +++ b/content/en-us/assets/players/in-experience-text-chat/TextChatService-BubbleChatConfiguration.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c32a194700621eca417002852167a5ca648da112291eebcf61663139ab0e2147 -size 20162 +oid sha256:a66225e5860ea6427058aa56d2f3f4121c8dbce849a832ab5e444898de3404ee +size 41260 diff --git a/content/en-us/assets/players/in-experience-text-chat/TextChatService-Configuration-Objects.png b/content/en-us/assets/players/in-experience-text-chat/TextChatService-Configuration-Objects.png index 65f5c42da..d4cadeeda 100644 --- a/content/en-us/assets/players/in-experience-text-chat/TextChatService-Configuration-Objects.png +++ b/content/en-us/assets/players/in-experience-text-chat/TextChatService-Configuration-Objects.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:56847cb73f2439d35548db427c0ecc1dc25f28e89577ea6e27a3cf574cff4087 -size 65929 +oid sha256:b103928a9fe7845896c48acb98f33f114d23cea8da7ab151c2d90308ca2da90d +size 223174 diff --git a/content/en-us/assets/studio/explorer/TextChatService-ChannelTabsConfiguration.png b/content/en-us/assets/studio/explorer/TextChatService-ChannelTabsConfiguration.png new file mode 100644 index 000000000..05ea4ee16 --- /dev/null +++ b/content/en-us/assets/studio/explorer/TextChatService-ChannelTabsConfiguration.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a73a317bdaf47e8a2616d9a43fbfdfb28cf74ad061b48cee081d3034350c6876 +size 35843 diff --git a/content/en-us/assets/studio/explorer/TextChatService-ChatInputBarConfiguration.png b/content/en-us/assets/studio/explorer/TextChatService-ChatInputBarConfiguration.png new file mode 100644 index 000000000..e1a078ae1 --- /dev/null +++ b/content/en-us/assets/studio/explorer/TextChatService-ChatInputBarConfiguration.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9a1278dc34e08cda716226918a3bae216a87fd73409f6eb51a2ee99642c2c986 +size 35898 diff --git a/content/en-us/assets/studio/explorer/TextChatService-ChatWindowConfiguration.png b/content/en-us/assets/studio/explorer/TextChatService-ChatWindowConfiguration.png new file mode 100644 index 000000000..ec0bb5d39 --- /dev/null +++ b/content/en-us/assets/studio/explorer/TextChatService-ChatWindowConfiguration.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ab14946f6310a2ae3899a66e10542db98487ab789f3aa9239dfcfcc26e55bf73 +size 35360 diff --git a/content/en-us/assets/studio/explorer/TextChatService-TextChatCommand.png b/content/en-us/assets/studio/explorer/TextChatService-TextChatCommand.png new file mode 100644 index 000000000..55b2996cd --- /dev/null +++ b/content/en-us/assets/studio/explorer/TextChatService-TextChatCommand.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:24bd0b7c7e23b26020ae7e3177a009d96a1fc83ba140c84c4df35147b0b4e600 +size 39194 diff --git a/content/en-us/chat/bubble-chat.md b/content/en-us/chat/bubble-chat.md index edbb1b591..ca3933fa9 100644 --- a/content/en-us/chat/bubble-chat.md +++ b/content/en-us/chat/bubble-chat.md @@ -7,21 +7,21 @@ With the [in-experience text chat](../chat/in-experience-text-chat.md) system, y -## Bubble Chat Configuration +## Enabling Bubble Chat To enable bubble chat in your experience: -1. In the [Explorer](../studio/explorer.md) window, select **BubbleChatConfiguration** under **TextChatService**. +1. In the [Explorer](../studio/explorer.md) window, select `Class.BubbleChatConfiguration` under `Class.TextChatService`. -2. In the [Properties](../studio/properties.md) window, check the **Enabled** checkbox under the **Behavior** category. +2. In the [Properties](../studio/properties.md) window, check the `Class.BubbleChatConfiguration.Enabled|Enabled` checkbox. ## Bubble Customization -After enabling bubble chat, you can customize the appearance and behavior of your chat bubbles to match your experience theme. Use the [Properties](../studio/properties.md) window of **BubbleChatConfiguration** for [basic](#basic-customization) changes like text color and spacing. For [advanced](#advanced-customization) customization, such as adding background images for bubbles, add UI objects as children of **BubbleChatConfiguration** and then modify these objects. +After enabling bubble chat, you can customize the appearance and behavior of your chat bubbles to match your experience theme. Use the [Properties](../studio/properties.md) window of `Class.BubbleChatConfiguration` for [basic](#basic-customization) changes like text color and spacing, or implement [advanced](#advanced-customization) customization for bubble background images and other visual adjustments. @@ -31,8 +31,8 @@ Alternatively, you can add a `Class.LocalScript` in `Class.StarterPlayerScripts` The following table shows common bubble chat customization properties. For a full list of customization properties, see `Class.BubbleChatConfiguration`. -#### Appearance - + + @@ -45,28 +45,27 @@ The following table shows common bubble chat customization properties. For a ful - + - + - + - +
`Class.BubbleChatConfiguration.BackgroundColor3|BackgroundColor3` Background color of bubbles in `Datatype.Color3`.[250, 250, 250]`[250, 250, 250]`
`Class.BubbleChatConfiguration.FontFace|FontFace` `Datatype.Font` of the bubble text.`Enum.Font|GothamMedium``Enum.Font.BuilderSansMedium|BuilderSansMedium`
`Class.BubbleChatConfiguration.TextColor3|TextColor3` Color of bubble text in `Datatype.Color3`.[57, 59, 61]`[57, 59, 61]`
`Class.BubbleChatConfiguration.TextSize|TextSize` Size of bubble text.16`16`
- -#### Behavior - +
+ @@ -84,93 +83,101 @@ The following table shows common bubble chat customization properties. For a ful - + - + - + - + - + - + - + - +
`Class.BubbleChatConfiguration.AdorneeName|AdorneeName` String name of the body part or `Class.Attachment` that bubbles attach to; if multiple instances of the same name exist, the system attaches to the first instance found.HumanoidRootPart`HumanoidRootPart`
`Class.BubbleChatConfiguration.BubbleDuration|BubbleDuration` Time before a bubble fades out, in seconds.30`30`
`Class.BubbleChatConfiguration.BubblesSpacing|BubblesSpacing` Vertical space between stacked bubbles, in pixels.6`6`
`Class.BubbleChatConfiguration.LocalPlayerStudsOffset|LocalPlayerStudsOffset` If adorned to the local player, the offset of bubbles in studs from their adornee, relative to the camera orientation (`Datatype.Vector3`).(0, 0, 0)`(0, 0, 0)`
`Class.BubbleChatConfiguration.MaxDistance|MaxDistance` Maximum distance from the camera that bubbles are shown.100`100`
`Class.BubbleChatConfiguration.MinimizeDistance|MinimizeDistance` Distance from the camera when bubbles turn into a single bubble with an ellipsis (**⋯**) to indicate chatter.40`40`
`Class.BubbleChatConfiguration.VerticalStudsOffset|VerticalStudsOffset` Extra space between bubbles and their adornee, in studs.0`0`
`Class.BubbleChatConfiguration.MaxBubbles|MaxBubbles` Maximum number of bubbles displayed before older bubbles disappear.3`3`
+
+
### Advanced Customization -For advanced customization of your bubble, add UI objects representing certain aspects of the bubble appearance as children under **BubbleChatConfiguration**, including: +For advanced customization of your bubble, add UI objects representing certain aspects of the bubble appearance as children under `Class.BubbleChatConfiguration`, including: - `Class.ImageLabel` for background image settings. - `Class.UIGradient` for background gradient settings. - `Class.UICorner` for the corner shape of bubbles. - `Class.UIPadding` for the padding space between the text and bubble edges, relative to the parent's normal size. -To add these objects as children of **BubbleChatConfiguration**, you can either add a script or use the Studio user interface directly: +After adding these objects, you can modify properties of these objects applicable to chat bubbles for advanced bubble customization. The following example `Class.LocalScript` adds a background image and sharp corners to bubbles: -1. Hover over **BubbleChatConfiguration** and click the ⊕ button. -2. Select the object from list. +```lua title="Advanced Bubble Customization" +local TextChatService = game:GetService("TextChatService") -After adding these objects, you can modify properties of these objects applicable to chat bubbles for advanced bubble customization. The following example client-side `Class.LocalScript` adds a background image and sharp corners to bubbles: +local bubbleChatConfiguration = TextChatService.BubbleChatConfiguration +bubbleChatConfiguration.TailVisible = false +bubbleChatConfiguration.TextColor3 = Color3.fromRGB(220, 50, 50) +bubbleChatConfiguration.FontFace = Font.fromEnum(Enum.Font.LuckiestGuy) -```lua title="Advanced Bubble Customization" -local BubbleChatConfiguration = game:GetService("TextChatService").BubbleChatConfiguration -BubbleChatConfiguration.TailVisible = false -BubbleChatConfiguration.TextSize = 24 -BubbleChatConfiguration.TextColor3 = Color3.fromRGB(220, 50, 50) -BubbleChatConfiguration.FontFace = Font.fromEnum(Enum.Font.LuckiestGuy) - -local UICorner = BubbleChatConfiguration:FindFirstChildOfClass("UICorner") -if not UICorner then - UICorner = Instance.new("UICorner") - UICorner.Parent = BubbleChatConfiguration +local bubbleUICorner = bubbleChatConfiguration:FindFirstChildOfClass("UICorner") +if not bubbleUICorner then + bubbleUICorner = Instance.new("UICorner") + bubbleUICorner.Parent = bubbleChatConfiguration end -UICorner.CornerRadius = UDim.new(0, 0) +bubbleUICorner.CornerRadius = UDim.new(0, 0) -local ImageLabel = BubbleChatConfiguration:FindFirstChildOfClass("ImageLabel") -if not ImageLabel then - ImageLabel = Instance.new("ImageLabel") - ImageLabel.Parent = BubbleChatConfiguration +local bubbleUIPadding = bubbleChatConfiguration:FindFirstChildOfClass("UIPadding") +if not bubbleUIPadding then + bubbleUIPadding = Instance.new("UIPadding") + bubbleUIPadding.Parent = bubbleChatConfiguration +end +bubbleUIPadding.PaddingTop = UDim.new(0, 20) +bubbleUIPadding.PaddingRight = UDim.new(0, 10) +bubbleUIPadding.PaddingBottom = UDim.new(0, 15) +bubbleUIPadding.PaddingLeft = UDim.new(0, 10) + +local bubbleImageLabel = bubbleChatConfiguration:FindFirstChildOfClass("ImageLabel") +if not bubbleImageLabel then + bubbleImageLabel = Instance.new("ImageLabel") + bubbleImageLabel.Parent = bubbleChatConfiguration end -ImageLabel.Image = "rbxassetid://6733332557" -ImageLabel.ScaleType = Enum.ScaleType.Slice -ImageLabel.SliceCenter = Rect.new(40, 40, 360, 160) -ImageLabel.SliceScale = 0.5 +bubbleImageLabel.Image = "rbxassetid://6733332557" +bubbleImageLabel.ScaleType = Enum.ScaleType.Slice +bubbleImageLabel.SliceCenter = Rect.new(40, 40, 320, 120) +bubbleImageLabel.SliceScale = 0.5 ``` - - -The following tables include all available properties for customization: + -

ImageLabel

+The following tables outline the available `Class.GuiObject` and [appearance modifier](../ui/appearance-modifiers.md) children along with their valid customization properties: + + @@ -188,17 +195,17 @@ The following tables include all available properties for customization: - + - + - - + + @@ -208,23 +215,22 @@ The following tables include all available properties for customization: - + - + - +
`Class.ImageLabel.ImageColor3|ImageColor3` Color tint of the bubble background image in `Datatype.Color3`.[255, 255, 255]`[255, 255, 255]`
`Class.ImageLabel.ImageRectOffset|ImageRectOffset` Offset of the image area to be displayed from the top-left in pixels.(0, 0)`(0, 0)`
`Class.ImageLabel.ImageRectSize|ImageRectSize`Size of the image area to be displayed in pixels. To display the entire image, set either dimension to 0.(0, 0)Size of the image area to be displayed in pixels. To display the entire image, set either dimension to `0`.`(0, 0)`
`Class.ImageLabel.ScaleType|ScaleType`
`Class.ImageLabel.SliceCenter|SliceCenter` Slice boundaries of the image if the image is a 9-sliced image. Only applicable when you set `Class.ImageLabel.ScaleType|ScaleType` as `Enum.ScaleType|Slice`. (0, 0, 0, 0)`(0, 0, 0, 0)`
`Class.ImageLabel.SliceScale|SliceScale` Scale ratio of slice edges if the image is a 9-sliced image. Only applicable when you set `Class.ImageLabel.ScaleType|ScaleType` as `Enum.ScaleType|Slice`.1`1`
`Class.ImageLabel.TileSize|TileSize` Tiling size of the image. Only applicable when you set `Class.ImageLabel.ScaleType|ScaleType` as `Enum.ScaleType|Tile`.(1, 0, 1, 0)`(1, 0, 1, 0)`
- -

UIGradient

- +
+ @@ -242,28 +248,27 @@ The following tables include all available properties for customization: - + - + - + - +
`Class.UIGradient.Color|Color` Color of the background gradient.[250, 250, 250]`[250, 250, 250]`
`Class.UIGradient.Offset|Offset` Scalar translation of the gradient from the center of the bubble.(0, 0)`(0, 0)`
`Class.UIGradient.Rotation|Rotation` Clockwise rotation, in degrees, of the gradient starts from left to right.0`0`
`Class.UIGradient.Transparency|Transparency` Transparency of the background gradient.(1, 0)`(1, 0)`
- -

UICorner

- +
+ @@ -276,13 +281,12 @@ The following tables include all available properties for customization: - +
`Class.UICorner.CornerRadius|CornerRadius` Radius of the bubble corner shape in pixels.(0, 12)`(0, 12)`
- -

UIGradient

- +
+ @@ -295,27 +299,27 @@ The following tables include all available properties for customization: - + - - + + - + - +
`Class.UIPadding.PaddingBottom|PaddingBottom` Padding on the bottom. `UDim.new(0,8)``Datatype.UDim.new(0,8)`
`Class.UIPadding.PaddingLeft|PaddingLeft`>Padding on the left.`UDim.new(0,8)`Padding on the left.`Datatype.UDim.new(0,8)`
`Class.UIPadding.PaddingRight|PaddingRight` Padding on the right.`UDim.new(0,8)``Datatype.UDim.new(0,8)`
`Class.UIPadding.PaddingTop|PaddingTop` Padding on the top.`UDim.new(0,8)``Datatype.UDim.new(0,8)`
- -
+
+
## Per-Bubble Customization @@ -323,37 +327,6 @@ You can individually style and modify chat bubble behaviors based on specific co To set per-bubble customization, add a client-side `Class.LocalScript` using `Class.BubbleChatMessageProperties`, which overrides matching properties of `Class.BubbleChatConfiguration`, and the `Class.TextChatService.OnBubbleAdded` callback to specify how to customize each bubble. The callback supplies you with the `Class.TextChatMessage` property as well as the adornee, so you can apply the customization based on attributes associated with users, the chat text content, user character properties, and any special conditions you want to define. -The following example adds special appearance to VIP users' chat bubbles by checking if a chat message sender has the `IsVIP` attribute: - -```lua title="VIP Bubbles" -local TextChatService = game:GetService("TextChatService") -local Players = game:GetService("Players") - --- Event handler for when a new chat bubble is added to the experience -TextChatService.OnBubbleAdded = function(message: TextChatMessage, adornee: Instance) - -- Check if the chat message has a TextSource (sender) associated with it - if message.TextSource then - -- Create a new BubbleChatMessageProperties instance to customize the chat bubble - local bubbleProperties = Instance.new("BubbleChatMessageProperties") - - -- Get the user who sent the chat message based on their UserId - local player = Players:GetPlayerByUserId(message.TextSource.UserId) - - if player:GetAttribute("IsVIP") then - -- If the player is a VIP, customize the chat bubble properties - bubbleProperties.TextColor3 = Color3.fromHex("#F5CD30") - bubbleProperties.BackgroundColor3 = Color3.fromRGB(25, 27, 29) - bubbleProperties.FontFace = Font.fromEnum(Enum.Font.PermanentMarker) - end - return bubbleProperties - end -end -``` - - - -### Available Options - The following basic customization properties are available for per-bubble customization: @@ -368,31 +341,60 @@ The following basic customization properties are available for per-bubble custom - + - + - + - + - +
`Class.BubbleChatConfiguration.BackgroundColor3|BackgroundColor3` Background color of bubbles in `Datatype.Color3`.(250, 250, 250)`(250, 250, 250)`
`Class.BubbleChatConfiguration.BackgroundTransparency|BackgroundTransparency` Background transparency of bubbles.0.1`0.1`
`Class.BubbleChatConfiguration.FontFace|FontFace` `Datatype.Font` of the bubble text.`Enum.Font|GothamMedium``Enum.Font.BuilderSansMedium|BuilderSansMedium`
`Class.BubbleChatConfiguration.TextColor3|TextColor3` Color of bubble text in `Datatype.Color3`.[57, 59, 61]`[57, 59, 61]`
`Class.BubbleChatConfiguration.TextSize|TextSize` Size of bubble text.16`16`
+The following example adds special appearance to VIP users' chat bubbles by checking if a chat message sender has the `IsVIP` attribute: + +```lua title="VIP Bubbles" +local TextChatService = game:GetService("TextChatService") +local Players = game:GetService("Players") + +-- Event handler for when a new chat bubble is added to the experience +TextChatService.OnBubbleAdded = function(message: TextChatMessage, adornee: Instance) + -- Check if the chat message has a TextSource (sender) associated with it + if message.TextSource then + -- Create a new BubbleChatMessageProperties instance to customize the chat bubble + local bubbleProperties = Instance.new("BubbleChatMessageProperties") + + -- Get the user who sent the chat message based on their UserId + local player = Players:GetPlayerByUserId(message.TextSource.UserId) + + if player:GetAttribute("IsVIP") then + -- If the player is a VIP, customize the chat bubble properties + bubbleProperties.TextColor3 = Color3.fromHex("#F5CD30") + bubbleProperties.BackgroundColor3 = Color3.fromRGB(25, 27, 29) + bubbleProperties.FontFace = Font.fromEnum(Enum.Font.PermanentMarker) + end + return bubbleProperties + end +end +``` + + + All advanced customization options are available for per-bubble customization. Similar to advanced customization for general bubbles, add instances that you want to customize as children of `Class.BubbleChatMessageProperties`. The following example adds a special gradient effect along with other properties to chat bubbles of users with low health status by checking the `Class.Humanoid.Health` property of chat message senders' characters: ```lua title="Low Health Bubbles" diff --git a/content/en-us/chat/customizing-in-experience-text-chat.md b/content/en-us/chat/customizing-in-experience-text-chat.md index 314b0f80d..ed67b7b0b 100644 --- a/content/en-us/chat/customizing-in-experience-text-chat.md +++ b/content/en-us/chat/customizing-in-experience-text-chat.md @@ -1,51 +1,85 @@ --- -title: Customizing In-Experience Text Chat +title: Customizing Text Chat description: Customize the chat window and message UI of your in-experience text chat. --- -The [in-experience text chat system](../chat/in-experience-text-chat.md) powered by `Class.TextChatService` allows users to easily communicate and socialize with each other in live experiences. In addition to supporting the default text chat, you can customize the front-end user interface (UI) to improve your user engagement and immersion. +The [in-experience text chat](../chat/in-experience-text-chat.md) system, powered by `Class.TextChatService`, allows players to easily communicate and socialize with each other in live experiences. In addition to supporting the default text chat, you can [customize](#chat-window-configuration) the front‑end user interface. ## Chat Window Configuration -You can toggle appearance of the **chat window** and **input bar** in one of two ways: +The overall chat window consists of the **chat window**, an **input bar**, and optional **channel tabs**. -- Directly in Studio by toggling the **Enabled** property of the service's **ChatWindowConfiguration** and **ChatInputBarConfiguration** children. +Core components of the text chat window. - - - - - -
-
-
+The channel tabs are disabled by default and each component can be toggled on/off in Studio or through scripting: -- Through scripting, from a `Class.LocalScript` within `Class.StarterPlayerScripts`. + + +Directly in Studio's [Explorer](../studio/explorer.md) window, expand the `Class.TextChatService` branch and select `Class.ChatWindowConfiguration`, `Class.ChatInputBarConfiguration`, or `Class.ChannelTabsConfiguration`. Then, in the [Properties](../studio/properties.md) window, enable or disable the component. - ```lua title='LocalScript' highlight='3,4,7,10' - local TextChatService = game:GetService("TextChatService") + + + +In a client script within `Class.StarterPlayerScripts`, enable each component as desired: - local chatWindowConfiguration = TextChatService:FindFirstChildOfClass("ChatWindowConfiguration") - local chatInputBarConfiguration = TextChatService:FindFirstChildOfClass("ChatInputBarConfiguration") +```lua title='Client Script' +local TextChatService = game:GetService("TextChatService") + +local ChatWindowConfiguration = TextChatService:FindFirstChildOfClass("ChatWindowConfiguration") +local ChatInputBarConfiguration = TextChatService:FindFirstChildOfClass("ChatInputBarConfiguration") +local ChannelTabsConfiguration = TextChatService:FindFirstChildOfClass("ChannelTabsConfiguration") - if chatWindowConfiguration then - chatWindowConfiguration.Enabled = true - end - if chatInputBarConfiguration then - chatInputBarConfiguration.Enabled = true - end - ``` +-- Enable chat window +if ChatWindowConfiguration then + ChatWindowConfiguration.Enabled = true +end +-- Enable input bar +if ChatInputBarConfiguration then + ChatInputBarConfiguration.Enabled = true +end +-- Enable channel tabs +if ChannelTabsConfiguration then + ChannelTabsConfiguration.Enabled = true +end +``` -By default, when enabling both the chat window and the chat bar, the chat bar attaches to the chat window on the UI. You can obtain their read-only properties on their positions and sizes and use them to calculate the total size of the combination: + + + +When `Class.ChannelTabsConfiguration` is enabled, each **default** `Class.TextChannel` will appear in a tab as outlined in the following table. In addition, each **custom** `Class.TextChannel` will create a tab corresponding to the channel's `Class.Instance.Name|Name` property. + + + + + + + + + + + + + + + + + + + + + + + + + + +
Default ChannelTab Name
**RBXGeneral****General**
**RBXSystem****General** (combined into a single tab with **RBXGeneral**)
**RBXTeam****Team**
**RBXWhisper**User name of other player
-- `Class.ChatWindowConfiguration.AbsolutePosition` -- `Class.ChatWindowConfiguration.AbsoluteSize` -- `Class.ChatInputBarConfiguration.AbsolutePosition` -- `Class.ChatInputBarConfiguration.AbsoluteSize` +### Window Appearance -### Chat Window Customization +Appearance of the overall **chat window** is customizable through `Class.ChatWindowConfiguration`. -You can customize the default chat window to match your experience's UI layout, design, and style by using the following properties in Studio: +ChatWindowConfiguration instance in Explorer hierarchy. @@ -56,111 +90,214 @@ You can customize the default chat window to match your experience's UI layout, - - - - + - - + + - - + + - + - + - + - - + + + + + + + - + + + - + - +
**Appearance**
`Class.ChatWindowConfiguration.BackgroundColor3|BackgroundColor3`Background color of the chat window in `Datatype.Color3`.`Datatype.Color3` background color of the chat window. `[25, 27, 29]`
`Class.ChatWindowConfiguration.BackgroundTransparency|BackgroundTransparency`Transparency of the chat window.0.3Transparency of the chat window's background.`0.3`
`Class.ChatWindowConfiguration.FontFace|FontFace``Datatype.Font` of chat text displayed on the chat window.`Enum.Font.GothamMedium``Datatype.Font` of chat window text.`Enum.Font.BuilderSansMedium|BuilderSansMedium`
`Class.ChatWindowConfiguration.TextColor3|TextColor3`Color of chat text displayed on the chat window in `Datatype.Color3`.`Datatype.Color3` of chat window text. `[255, 255, 255]`
`Class.ChatWindowConfiguration.TextSize|TextSize`Size of chat text displayed on the chat window.Size of chat window text. `14`
`Class.ChatWindowConfiguration.TextStrokeColor3|TextStrokeColor3`Chat text stroke color displayed on the chat window in `Datatype.Color3`.`Datatype.Color3` of the stroke for chat window text. `[0, 0, 0]`
`Class.ChatWindowConfiguration.TextStrokeTransparency|TextStrokeTransparency`Transparency of chat text stroke displayed on the chat window.0.5Transparency of the stroke for chat window text.`0.5`
`Class.ChatWindowConfiguration.HorizontalAlignment|HorizontalAlignment`Horizontal alignment of the chat window.`Enum.HorizontalAlignment.Left|Left`
**Behavior**`Class.ChatWindowConfiguration.VerticalAlignment|VerticalAlignment`Vertical alignment of the chat window.`Enum.VerticalAlignment.Top|Top`
`Class.ChatWindowConfiguration.HeightScale|HeightScale` Height scale of the chat window relative to the screen size.1`1`
`Class.ChatWindowConfiguration.WidthScale|WidthScale` Width scale of the chat window relative to the screen size.1`1`
-### Emoji and Command Autocomplete - -By default, the text chat system shows autocomplete options for emojis and [commands](../chat/in-experience-text-chat.md#creating-custom-commands): - -- Emojis are autocompleted by typing `:` followed by non-whitespace characters. -- Commands are autocompleted by typing `/`. +### Input Bar Appearance -If you want to disable the autocomplete behavior, set the **AutocompleteEnabled** property to false through Studio UI or scripting. +Appearance of the chat **input bar** is customizable through `Class.ChatInputBarConfiguration`. -## Customizing Message Appearance +ChatInputBarConfiguration instance in Explorer hierarchy. -You can customize the appearance of chat message bodies and prefixes using [rich text](../ui/rich-text.md) tags and `Class.TextChatService.OnIncomingMessage` callbacks without overriding the existing UI. The customization options let you modify the appearance of chat messages to match your experience's theme, and you can also sort or highlight messages from different user groups by [adding chat tags](#adding-chat-tags) and [coloring usernames](#coloring-usernames). + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PropertyDescriptionDefault
`Class.ChatInputBarConfiguration.BackgroundColor3|BackgroundColor3``Datatype.Color3` background color of the chat input bar.`[25, 27, 29]`
`Class.ChatInputBarConfiguration.BackgroundTransparency|BackgroundTransparency`Transparency of the chat input bar's background.`0.2`
`Class.ChatInputBarConfiguration.FontFace|FontFace``Datatype.Font` of chat input text.`Enum.Font.BuilderSansMedium|BuilderSansMedium`
`Class.ChatInputBarConfiguration.PlaceholderColor3|PlaceholderColor3``Datatype.Color3` of placeholder chat input text.`[178, 178, 178]`
`Class.ChatInputBarConfiguration.TextColor3|TextColor3``Datatype.Color3` of player-entered chat input text.`[255, 255, 255]`
`Class.ChatInputBarConfiguration.TextSize|TextSize`Size of chat input text.`14`
`Class.ChatInputBarConfiguration.TextStrokeColor3|TextStrokeColor3``Datatype.Color3` stroke color of chat input text.`[0, 0, 0]`
`Class.ChatInputBarConfiguration.TextStrokeTransparency|TextStrokeTransparency`Transparency of the stroke for chat input text.`0.5`
`Class.ChatInputBarConfiguration.AutocompleteEnabled|AutocompleteEnabled`Whether the text chat system shows autocomplete options for emojis and [commands](../chat/in-experience-text-chat.md#creating-custom-commands). Emojis are autocompleted by typing `:` followed by non-whitespace characters, while commands are autocompleted by typing `/`.`true`
`Class.ChatInputBarConfiguration.KeyboardKeyCode|KeyboardKeyCode`Additional key players can press to trigger focusing on the default chat input bar.`Enum.KeyCode.Slash|Slash`
- - You should only define `Class.TextChatService.OnIncomingMessage` once in the source code. Multiple bindings might override one another in an unpredictable manner. - +### Channel Tabs Appearance -### Adding Chat Tags +Appearance of the **channel tabs** is customizable through `Class.ChannelTabsConfiguration`. -If your experience has users with special [attributes](../studio/properties.md#instance-attributes) like VIP status, you can attach chat tags wrapped in brackets to the front of user messages to highlight their chat messages. The following `Class.LocalScript` in `Class.StarterPlayerScripts` examines all `Class.Player` instances representing users in your experience and appends VIP chat tags for those with the `IsVIP` attribute. +ChannelTabsConfiguration instance in Explorer hierarchy. -```lua title='LocalScript' highlight='4,5,9-11' -local TextChatService = game:GetService("TextChatService") -local Players = game:GetService("Players") + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PropertyDescriptionDefault
`Class.ChannelTabsConfiguration.BackgroundColor3|BackgroundColor3``Datatype.Color3` background color of the channel tabs.`[25, 27, 29]`
`Class.ChannelTabsConfiguration.BackgroundTransparency|BackgroundTransparency`Transparency of the channel tabs' background.`0`
`Class.ChannelTabsConfiguration.HoverBackgroundColor3|HoverBackgroundColor3``Datatype.Color3` background color of tabs when hovering over them.`[125, 125, 125]`
`Class.ChannelTabsConfiguration.FontFace|FontFace``Datatype.Font` for the text in channel tabs.`Enum.Font.BuilderSansBold|BuilderSansBold`
`Class.ChannelTabsConfiguration.TextColor3|TextColor3``Datatype.Color3` of text in an unselected tab.`[175, 175, 175]`
`Class.ChannelTabsConfiguration.SelectedTabTextColor3|SelectedTabTextColor3``Datatype.Color3` of text in a selected tab.`[255, 255, 255]`
`Class.ChannelTabsConfiguration.TextSize|TextSize`Size of the text in channel tabs.`18`
`Class.ChannelTabsConfiguration.TextStrokeColor3|TextStrokeColor3``Datatype.Color3` stroke color of the text in channel tabs.`[0, 0, 0]`
`Class.ChannelTabsConfiguration.TextStrokeTransparency|TextStrokeTransparency`Transparency of the stroke for text in channel tabs.`1`
-TextChatService.OnIncomingMessage = function(message: TextChatMessage) - local properties = Instance.new("TextChatMessageProperties") +## Customizing Messages - if message.TextSource then - local player = Players:GetPlayerByUserId(message.TextSource.UserId) - if player:GetAttribute("IsVIP") then - properties.PrefixText = "[VIP] " .. message.PrefixText - end - end +You can customize the appearance of chat message bodies and prefixes using `Class.ChatWindowMessageProperties` and `Class.TextChatService.OnChatWindowAdded` callbacks without overriding the existing UI. The customization options let you modify the appearance of chat messages to match your experience's theme, and you can also sort or highlight messages from different user groups by adding chat tags and coloring prefixes. - return properties -end -``` + +`Class.ChatWindowMessageProperties` and `Class.TextChatService.OnChatWindowAdded|OnChatWindowAdded` will only affect the appearance of messages in the chat window. To customize chat bubbles, see [Bubble Chat](../chat/bubble-chat.md). + -VIP users' chat tags +### Coloring User Names -### Coloring Usernames +When a user sends a chat message, their `Class.Player.DisplayName|DisplayName` displays as the **prefix** portion of the message. By default, each user's name is colored according to their `Class.Player.TeamColor` but you can change the colors of chat names using `Class.ChatWindowMessageProperties|ChatWindowMessageProperties` and `Class.TextChatService.OnChatWindowAdded|OnChatWindowAdded`. The following `Class.LocalScript` in `Class.StarterPlayerScripts` assigns a predetermined color to each user, picking randomly from a table of RGB colors. -When a user sends a chat message, their username displays as the prefix portion of the message. By default, each user's name is colored according to their `Class.Team.TeamColor|TeamColor` but you can change the colors of chat usernames using `Class.TextChatService.OnIncomingMessage` and [font color tags](../ui/rich-text.md#supported-tags). The following `Class.LocalScript` in `Class.StarterPlayerScripts` assigns a predetermined color to each user, picking randomly from a table of RGB colors. +Colored user name in the chat window. -```lua title='LocalScript' hightlight='10,11,17' +```lua title="LocalScript - Random User Name Colors" local TextChatService = game:GetService("TextChatService") +local chatWindowConfiguration = TextChatService.ChatWindowConfiguration + local nameColors = { Color3.fromRGB(255, 0, 0), Color3.fromRGB(0, 255, 0), @@ -168,58 +305,165 @@ local nameColors = { Color3.fromRGB(255, 255, 0), } -TextChatService.OnIncomingMessage = function(textChatMessage: TextChatMessage) - local properties = Instance.new("TextChatMessageProperties") +TextChatService.OnChatWindowAdded = function(message: TextChatMessage) + local properties = chatWindowConfiguration:DeriveNewMessageProperties() - local textSource = textChatMessage.TextSource + local textSource = message.TextSource if textSource then local index: number = (textSource.UserId % #nameColors) + 1 local randomColor: Color3 = nameColors[index] - properties.PrefixText = string.format("%s", randomColor:ToHex(), textChatMessage.PrefixText) + + properties.PrefixTextProperties = chatWindowConfiguration:DeriveNewMessageProperties() + properties.PrefixTextProperties.TextColor3 = randomColor end return properties end ``` -### Customizing Translated Messages +You can also apply color and transparency gradients to color message prefixes using `Class.UIGradient`. -By default, Roblox [automatically translates](../production/localization/automatic-translations.md) text chat messages based on users' language settings. To apply message customizations to translated messages, use the `Class.TextChatMessage.Translation` property. The following example, a `Class.Script` in `Class.ReplicatedStorage` with its `Enum.RunContext` property as `Enum.RunContext|Client`, sets the font color of translated messages to the same color as untranslated messages. +Gradient user name in the chat window. -```lua title='Script' +```lua title="Gradient User Name Colors" local TextChatService = game:GetService("TextChatService") -local FONT_COLOR = "#FF007F" -local FORMAT_STRING = `%s` +local chatWindowConfiguration = TextChatService.ChatWindowConfiguration -local function onIncomingChatMessage(textChatMessage: TextChatMessage) - local properties = Instance.new("TextChatMessageProperties") +local gradient = Instance.new("UIGradient") +gradient.Color = ColorSequence.new{ + ColorSequenceKeypoint.new(0, Color3.fromRGB(255, 0, 0)), + ColorSequenceKeypoint.new(0.5, Color3.fromRGB(255, 255, 0)), + ColorSequenceKeypoint.new(1, Color3.fromRGB(255, 0, 255)) +} - properties.Text = string.format(FORMAT_STRING, textChatMessage.Text) - - if textChatMessage.Translation ~= nil and textChatMessage.Translation ~= "" then - properties.Translation = string.format(FORMAT_STRING, textChatMessage.Translation) +TextChatService.OnChatWindowAdded = function(message: TextChatMessage) + local properties = chatWindowConfiguration:DeriveNewMessageProperties() + + local textSource = message.TextSource + if textSource then + properties.PrefixTextProperties = chatWindowConfiguration:DeriveNewMessageProperties() + gradient:Clone().Parent = properties.PrefixTextProperties end return properties end +``` + +### Adding Chat Tags + +If your experience has users with special [attributes](../studio/properties.md#instance-attributes) like VIP status, you can attach **chat tags** wrapped in brackets to the front of user messages to highlight their messages. The following `Class.LocalScript` in `Class.StarterPlayerScripts` examines all `Class.Player` instances representing users in your experience and appends VIP chat tags to those with the `IsVIP` attribute. + +VIP chat tag appended to user name in the chat window. + +```lua title="Appending Chat Tags" +local TextChatService = game:GetService("TextChatService") +local Players = game:GetService("Players") -TextChatService.OnIncomingMessage = onIncomingChatMessage +local chatWindowConfiguration = TextChatService.ChatWindowConfiguration + +TextChatService.OnChatWindowAdded = function(message: TextChatMessage) + local properties = chatWindowConfiguration:DeriveNewMessageProperties() + + if message.TextSource then + local player = Players:GetPlayerByUserId(message.TextSource.UserId) + if player:GetAttribute("IsVIP") then + properties.PrefixText = "[VIP] " .. message.PrefixText + + properties.PrefixTextProperties = chatWindowConfiguration:DeriveNewMessageProperties() + properties.PrefixTextProperties.TextColor3 = Color3.fromRGB(255, 125, 50) + end + end + + return properties +end ``` -## Displaying System Messages +### Rich Text Customization + +Rich text [font color tags](../ui/rich-text.md#supported-tags) can be used to format chat messages, helpful if you want to apply formatting to very specific parts of the message. Note that rich text does not support gradients, but the following code sample shows how you can move the user name (stored in `Class.TextChatMessage.PrefixText`) into the message body and then apply rich text tagging to only the name portion. -Through `Class.TextChannel:DisplaySystemMessage()`, you can display a system-like message, useful for greeting users or alerting them when an in-experience event is happening. +Rich text customization of user name in the chat window. -```lua title='LocalScript' +```lua title="Rich Text Customization" +local TextChatService = game:GetService("TextChatService") +local Players = game:GetService("Players") + +local chatWindowConfiguration = TextChatService.ChatWindowConfiguration + +local gradient = Instance.new("UIGradient") +gradient.Color = ColorSequence.new{ + ColorSequenceKeypoint.new(0, Color3.fromRGB(255, 0, 0)), + ColorSequenceKeypoint.new(0.5, Color3.fromRGB(255, 255, 0)), + ColorSequenceKeypoint.new(1, Color3.fromRGB(255, 0, 255)) +} + +TextChatService.OnChatWindowAdded = function(message: TextChatMessage) + local properties = chatWindowConfiguration:DeriveNewMessageProperties() + + if message.TextSource then + properties.PrefixText = "[VIP]" + properties.Text = string.format("%s", message.PrefixText) .. " " .. message.Text + + properties.PrefixTextProperties = chatWindowConfiguration:DeriveNewMessageProperties() + gradient:Clone().Parent = properties.PrefixTextProperties + end + + return properties +end +``` + +## Sending Messages from Non‑Player Sources + +In certain design scenarios, you may want to show non‑player dialogue in the chat window, such as "speech" from a public address system or a non‑player character. + +### System + +To deliver an unstyled system message to the local player, simply call `Class.TextChannel:DisplaySystemMessage()|DisplaySystemMessage()` from the default **RBXGeneral** channel with a prefix before the player's display name. + +```lua title='Client Script' local Players = game:GetService("Players") local TextChatService = game:GetService("TextChatService") -local generalChannel = TextChatService.TextChannels.RBXGeneral +local player = Players.LocalPlayer +local generalChannel: TextChannel = TextChatService:WaitForChild("TextChannels").RBXGeneral + +local PREFIX = "[Guide] Welcome " -generalChannel:DisplaySystemMessage("[Server] Hello " .. Players.LocalPlayer.Name) +-- Send "system message" to player with their display name appended +generalChannel:DisplaySystemMessage(PREFIX .. player.DisplayName) ``` -## Adding Chat Bubbles +Image showing a basic system message in the chat window. + +### NPC/Object + +You can also stylize non-player dialogue and add [chat bubbles](../chat/bubble-chat.md) to make it appear like messages are coming from an NPC or object within the 3D world. + +```lua title='Client Script' +local TextChatService = game:GetService("TextChatService") + +local generalChannel: TextChannel = TextChatService:WaitForChild("TextChannels").RBXGeneral + +TextChatService.OnIncomingMessage = function(textChatMessage: TextChatMessage) + local properties = Instance.new("TextChatMessageProperties") + + -- Check for system messages that contain metadata + if not textChatMessage.TextSource and textChatMessage.Metadata ~= "" then + + -- Add prefix to make message look like it was sent by a player + properties.PrefixText = string.format("%s: ", "#50C999", textChatMessage.Metadata) + + -- Add bubble chat + TextChatService:DisplayBubble(workspace.Statue, textChatMessage.Text) + end + + return properties +end + +local message = "Welcome! I will be your guide." +local speakerName = "Ancient Knight" +generalChannel:DisplaySystemMessage(message, speakerName) +``` -In addition to displaying messages on the chat window, you can add and customize chat bubbles above user avatars and NPC characters for immersive engagement. For more information, see [Bubble Chat](../chat/bubble-chat.md). +Image showing a knight statue NPC broadcasting a chat message to the chat window, along with a chat bubble above its head. diff --git a/content/en-us/chat/in-experience-text-chat.md b/content/en-us/chat/in-experience-text-chat.md index 15a8389d6..4b415017c 100644 --- a/content/en-us/chat/in-experience-text-chat.md +++ b/content/en-us/chat/in-experience-text-chat.md @@ -1,37 +1,37 @@ --- -title: In-Experience Text Chat System -description: The in-experience text chat system allows users to communicate with each other using text-based messages in live sessions. +title: In-Experience Text Chat +description: The in-experience text chat system allows players to communicate with each other using text-based messages in live sessions. --- -With the **in-experience text chat** system on Roblox, you can allow users to communicate with each other using text-based messages in live sessions. The system provides a set of methods and events for extending and customizing chat functionalities for enhanced user immersion and engagement, such as delivering messages based on customized requirements, adding special permissions or moderation to specific users, and creating custom commands to execute specific actions. +With the **in-experience text chat** system on Roblox, players can communicate with each other using text-based messages in live sessions. The system provides a set of methods and events for extending and customizing chat functionalities, such as delivering messages based on [customized requirements](#customizing-message-delivery-behaviors), adding special permissions or moderation to specific players, and creating [custom commands](#creating-custom-commands) to execute specific actions. -This guide covers the chat workflow and the usage of APIs for extending the functionalities of the in-experience text chat system. For more information on customizing the chat User Interface (UI), see [Customizing In-Experience Text Chat](../chat/customizing-in-experience-text-chat.md). +This guide covers the chat workflow and approaches for extending the functionalities of the chat system. For more information on customizing the chat user interface (UI), see [Customizing Text Chat](../chat/customizing-in-experience-text-chat.md). -## Chat APIs and Workflow +## Chat Workflow -The in-experience text chat system consists of both mutable APIs that you can extend for customized chat delivery behaviors and immutable data objects representing certain chat elements returned by mutable APIs. +The in-experience text chat system consists of both [mutable classes](#mutable-chat-classes) that you can extend for customized chat delivery behaviors and [immutable data objects](#immutable-chat-objects) representing certain chat elements returned by mutable classes. -### Mutable Chat APIs +### Mutable Chat Classes -The in-experience text chat system provides the following mutable APIs: +The in-experience text chat system provides the following mutable classes: -- `Class.TextChatService` — This singleton class is responsible for managing the overall chat system, including handling chat message filtering, moderation, and user permissions. Accessible from the server, it provides a set of methods and events that other text chat APIs or user actions can invoke through the chat delivery workflow. -- `Class.TextChannel` — This class represents a text chat channel that passes user-sent chat messages from the client to the server and displays them to other users based on permissions. You can use it to create, modify, and manage text channels in your experience. Additionally, you can create multiple text channels to group users together for chat purposes, such as allowing users to chat with their group members that are not visible to others. -- `Class.TextChatCommand` — This class enables you to create custom chat commands that allow users to invoke specific actions or behaviors by typing special characters followed by a command name. Chat commands are helpful for adding additional functionality and interactivity to the chat experience. You can also use them to create admin commands to manage and moderate your experience with shortcuts. +- `Class.TextChatService` — This singleton class is responsible for managing the overall chat system, including handling chat message filtering, moderation, and user permissions. Accessible from the server, it provides a set of methods and events that other text chat APIs or player actions can invoke through the chat delivery workflow. +- `Class.TextChannel` — This class represents a text chat channel that passes player-sent chat messages from the client to the server and displays them to other players based on permissions. You can use it to create, modify, and manage text channels in your experience. Additionally, you can create multiple text channels to group players together for chat purposes, such as allowing players to chat with their group members that are not visible to others. +- `Class.TextChatCommand` — This class enables you to create custom chat commands that allow players to invoke specific actions or behaviors by typing special characters followed by a command name. Chat commands are helpful for adding additional functionality and interactivity to the chat experience. You can also use them to create admin commands to manage and moderate your experience with shortcuts. ### Immutable Chat Objects The in-experience text chat system includes the following immutable objects with read-only properties that you can't modify: - `Class.TextChatMessage`: This object represents a single chat message in a text chat channel with basic information such as the sender of the message, the original message, the filtered message, and the creation timestamp. -- `Class.TextSource`: This object represents a message sender in a text chat channel with detailed permissions of a user in the channel. If a user is in multiple text chat channels, they can have multiple text sources as well. +- `Class.TextSource`: This object represents a message sender in a text chat channel with detailed permissions of a player in the channel. If a player is in multiple text chat channels, they can have multiple text sources as well. -### Text Chat Workflow +### Chat Flowchart -Through the chat message sending and delivering process, methods, callbacks, and events of mutable chat classes carrying immutable chat objects take place on three sides of the client-server model: +Through the chat message sending and delivery process, methods, callbacks, and events of mutable chat classes work alongside immutable chat objects on three sides of the [client‑server](../projects/client-server.md) model: -- The sending client, which is the local device of a user sending a message. -- Receiving clients, which are other users' local devices. +- The sending client, which is the local device of a player sending a message. +- Receiving clients, which are other players' local devices. - The server, which is the central processor for receiving the message from the sending client and handles the delivery to receiving clients. + 1. Set its **PrimaryAlias** property to `/super` and its **SecondaryAlias** to `/mini`. @@ -163,7 +159,7 @@ To switch the chat system of an existing experience from the legacy chat system -### Basic Chat Functionalities +### Basic Functionalities Though both systems share the same basic chat functionalities, the in-experience text chat system implementations are in general more sustainable and easier to iterate on. @@ -209,9 +205,9 @@ Though both systems share the same basic chat functionalities, the in-experience -### Chat Message Filtering +### Message Filtering -The in-experience text chat system automatically filters chat messages based on each user's account information, so you don't need to manually implement text filtering for all kinds of chat messages. +The in-experience text chat system automatically filters chat messages based on each player's account information, so you don't need to manually implement text filtering for all kinds of chat messages. @@ -223,7 +219,7 @@ The in-experience text chat system automatically filters chat messages based on - + @@ -235,7 +231,7 @@ The in-experience text chat system automatically filters chat messages based on
Filter Message for Individual UserFilter Message for Individual Player `Class.Chat:FilterStringAsync()` n/a
-### Chat Window and Bubble Chat +### Window and Bubble Chat Both the chat window and [bubble chat](../chat/bubble-chat.md) behavior and [customization](../chat/customizing-in-experience-text-chat.md) options of the in-experience text chat system are identical to those of the legacy chat system. As the legacy chat system only allows customization using chat modules or the `Class.Players` container, the in-experience text chat system provides dedicated classes, `Class.ChatWindowConfiguration` and `Class.BubbleChatConfiguration`, to manage all chat window and bubble chat properties respectively. Additionally, you can easily adjust and preview your bubble chat appearance and behavior properties using Studio settings instead of having to script them all. diff --git a/content/en-us/chat/legacy/admin-commands.md b/content/en-us/chat/legacy/admin-commands.md index ecc0c763a..5fb59c64e 100644 --- a/content/en-us/chat/legacy/admin-commands.md +++ b/content/en-us/chat/legacy/admin-commands.md @@ -6,7 +6,7 @@ comments: | --- - This guide covers admin commands of the legacy chat system, which is deprecated and no longer onboarding new users in favor of `Class.TextChatService` with easier and more modern chat settings. If you are using the default chat system powered by `Class.TextChatService`, see In-Experience Text Chat for creating custom chat commands. + This guide covers admin commands of the legacy chat system, which is deprecated and no longer onboarding new users in favor of `Class.TextChatService` with easier and more modern chat settings. If you are using the default chat system powered by `Class.TextChatService`, see [In-Experience Text Chat](../../chat/in-experience-text-chat.md#creating-custom-commands) for creating custom chat commands. An **admin command** is a keyword or phrase that a user with certain level of control can type into the chat window to trigger an action. This library uses chat modules, which allows for easy implementation of admin commands on top of the legacy chat system. Chat modules listen to incoming messages on the server and can execute actions based on whatever criteria is desired. diff --git a/content/en-us/reference/engine/classes/ChannelTabsConfiguration.yaml b/content/en-us/reference/engine/classes/ChannelTabsConfiguration.yaml index bf8660121..574b00c2e 100644 --- a/content/en-us/reference/engine/classes/ChannelTabsConfiguration.yaml +++ b/content/en-us/reference/engine/classes/ChannelTabsConfiguration.yaml @@ -2,8 +2,11 @@ name: ChannelTabsConfiguration type: class category: memory_category: Instances -summary: '' -description: '' +summary: | + Configures properties of the optional channel tabs in the default chat window. +description: | + Configures properties of the optional channel tabs in the default chat window. + It is parented to `Class.TextChatService`. code_samples: [] inherits: - TextChatConfigurations @@ -12,8 +15,10 @@ tags: deprecation_message: '' properties: - name: ChannelTabsConfiguration.AbsolutePosition - summary: '' - description: '' + summary: | + Actual screen position of the channel tab bar, in pixels. + description: | + Read-only property that provides the screen position of the channel tab bar in pixels. Behaves similarly to `Class.GuiBase2d.AbsolutePosition`. code_samples: [] type: Vector2 tags: @@ -32,8 +37,10 @@ properties: - Chat writeCapabilities: [] - name: ChannelTabsConfiguration.AbsoluteSize - summary: '' - description: '' + summary: | + Actual screen size of the channel tab bar, in pixels. + description: | + Read-only property that provides the screen size of the channel tab bar in pixels. Behaves similarly to `Class.GuiBase2d.AbsoluteSize`. code_samples: [] type: Vector2 tags: @@ -52,8 +59,14 @@ properties: - Chat writeCapabilities: [] - name: ChannelTabsConfiguration.BackgroundColor3 - summary: '' - description: '' + summary: | + Background color of the channel tabs. + description: | + Background color of the channel tabs. If the background color is not + overridden, this value will respect the user's + `Class.GuiService.PreferredTransparency` by making the menu more gray as + the transparency of the menu decreases. Default value is + `Datatype.Color3|Color3.new(25, 27, 29)`. code_samples: [] type: Color3 tags: [] @@ -70,8 +83,14 @@ properties: - Chat writeCapabilities: [] - name: ChannelTabsConfiguration.BackgroundTransparency - summary: '' - description: '' + summary: | + Background transparency of the channel tabs. + description: | + Background transparency of the channel tabs as a number between `0` and + `1`. This value is multiplied with the user's + `Class.GuiService.PreferredTransparency` to create the effective + background transparency used by the channel tabs, which may be more opaque + than this value set here. Default value is `0`. code_samples: [] type: double tags: [] @@ -88,8 +107,10 @@ properties: - Chat writeCapabilities: [] - name: ChannelTabsConfiguration.Enabled - summary: '' - description: '' + summary: | + Whether to show the channel tabs. + description: | + Whether to show the channel tabs. Set to `false` to hide. code_samples: [] type: bool tags: [] @@ -106,8 +127,10 @@ properties: - Chat writeCapabilities: [] - name: ChannelTabsConfiguration.FontFace - summary: '' - description: '' + summary: | + Font used to render text in the channel tabs. + description: | + Font used to render text in the channel tabs. Default is `Enum.Font.BuilderSansBold`. code_samples: [] type: Font tags: [] @@ -124,8 +147,11 @@ properties: - Chat writeCapabilities: [] - name: ChannelTabsConfiguration.HoverBackgroundColor3 - summary: '' - description: '' + summary: | + Background color of a channel tab when hovering over it. + description: | + Background color of a channel tab when hovering over it. Default value is + `Datatype.Color3|Color3.new(125, 125, 125)`. code_samples: [] type: Color3 tags: [] @@ -142,8 +168,11 @@ properties: - Chat writeCapabilities: [] - name: ChannelTabsConfiguration.SelectedTabTextColor3 - summary: '' - description: '' + summary: | + Color of text in a selected tab. + description: | + Color of text in a selected tab. Default value is + `Datatype.Color3|Color3.new(255, 255, 255)`. code_samples: [] type: Color3 tags: [] @@ -160,8 +189,11 @@ properties: - Chat writeCapabilities: [] - name: ChannelTabsConfiguration.TextColor3 - summary: '' - description: '' + summary: | + Color of text in an unselected tab. + description: | + Color of text in an unselected tab. Default value is + `Datatype.Color3|Color3.new(175, 175, 175)`. code_samples: [] type: Color3 tags: [] @@ -178,8 +210,10 @@ properties: - Chat writeCapabilities: [] - name: ChannelTabsConfiguration.TextSize - summary: '' - description: '' + summary: | + Size of the text in channel tabs. + description: | + Size of the text in channel tabs. Default value is `14`. code_samples: [] type: int64 tags: [] @@ -196,8 +230,11 @@ properties: - Chat writeCapabilities: [] - name: ChannelTabsConfiguration.TextStrokeColor3 - summary: '' - description: '' + summary: | + Color of the text stroke for text in channel tabs. + description: | + Color of the text stroke for text in channel tabs. Default value is + `Datatype.Color3|Color3.new(0, 0, 0)`. code_samples: [] type: Color3 tags: [] @@ -214,8 +251,11 @@ properties: - Chat writeCapabilities: [] - name: ChannelTabsConfiguration.TextStrokeTransparency - summary: '' - description: '' + summary: | + Transparency of the text stroke for text in channel tabs. + description: | + Transparency of the text stroke for text in channel tabs. Default value is + `1`. code_samples: [] type: double tags: [] diff --git a/content/en-us/reference/engine/classes/ChatInputBarConfiguration.yaml b/content/en-us/reference/engine/classes/ChatInputBarConfiguration.yaml index 936035210..b6659404e 100644 --- a/content/en-us/reference/engine/classes/ChatInputBarConfiguration.yaml +++ b/content/en-us/reference/engine/classes/ChatInputBarConfiguration.yaml @@ -5,9 +5,8 @@ memory_category: Instances summary: | Configures properties of the default chat input bar. description: | - Configures properties of the default chat input bar. - - It is parented to `Class.TextChatService`. + Configures properties of the default text chat input bar. It is parented to + `Class.TextChatService`. code_samples: [] inherits: - TextChatConfigurations @@ -17,8 +16,7 @@ deprecation_message: '' properties: - name: ChatInputBarConfiguration.AbsolutePosition summary: | - Describes the actual screen position of the default chat input bar in - pixels. + Actual screen position of the default chat input bar in pixels. description: | Read-only property that provides the screen position of the default chat input bar in pixels. Behaves similarly to @@ -42,7 +40,7 @@ properties: writeCapabilities: [] - name: ChatInputBarConfiguration.AbsoluteSize summary: | - Describes the actual screen size of the default chat input bar in pixels. + Actual screen size of the default chat input bar in pixels. description: | Read-only property that provides the screen size of the default chat input bar in pixels. Behaves similarly to `Class.GuiBase2d.AbsoluteSize`. @@ -65,10 +63,10 @@ properties: writeCapabilities: [] - name: ChatInputBarConfiguration.AutocompleteEnabled summary: | - Determines whether to enable autocomplete for the chat input bar. + Whether to enable autocomplete for the chat input bar. description: | - Determines whether to enable autocomplete for the chat input bar. Set to - false to disable autocomplete. + Whether to enable autocomplete for the chat input bar. Set to `false` to + disable autocomplete. code_samples: [] type: bool tags: [] @@ -86,10 +84,10 @@ properties: writeCapabilities: [] - name: ChatInputBarConfiguration.BackgroundColor3 summary: | - Determines the background color of the default chat input bar. + Background color of the default chat input bar. description: | - Determines the background color of the default chat input bar. Default - value is `Datatype.Color3|Color3.new(25,27,29)`. + Background color of the default chat input bar. Default value is + `Datatype.Color3|Color3.new(25, 27, 29)`. code_samples: [] type: Color3 tags: [] @@ -107,13 +105,13 @@ properties: writeCapabilities: [] - name: ChatInputBarConfiguration.BackgroundTransparency summary: | - Determines the background transparency of the default chat input bar. + Background transparency of the default chat input bar. description: | - Determines the background transparency of the default chat input bar as a - number between 0 and 1. This value is multiplied with the user's + Background transparency of the default chat input bar as a number between + `0` and `1`. This value is multiplied with the user's `Class.GuiService.PreferredTransparency` to create the effective background transparency used by the chat input bar, which may be more - opaque than this value set here. Default value is 0.2. + opaque than this value set here. Default value is `0.2`. code_samples: [] type: double tags: [] @@ -131,11 +129,9 @@ properties: writeCapabilities: [] - name: ChatInputBarConfiguration.Enabled summary: | - Determines whether to show the default chat input bar. + Whether to show the default chat input bar. description: | - Determines whether to show the default chat input bar. - - Set to false to hide the default chat input bar. + Whether to show the default chat input bar. Set to `false` to hide. code_samples: [] type: bool tags: [] @@ -153,9 +149,9 @@ properties: writeCapabilities: [] - name: ChatInputBarConfiguration.FontFace summary: | - Determines the font used to render text in the default chat input bar. + Font used to render text in the default chat input bar. description: | - Determines the font used to render text in the default chat input bar. + Font used to render text in the default chat input bar. Default is `Enum.Font.BuilderSansMedium`. code_samples: [] type: Font tags: [] @@ -173,7 +169,7 @@ properties: writeCapabilities: [] - name: ChatInputBarConfiguration.IsFocused summary: | - Describes if the default chat input bar is focused or not. + Whether the default chat input bar is focused or not. description: | Indicates whether the default chat input bar is focused or not. Useful for firing property changed events so you can implement callback functions @@ -198,12 +194,12 @@ properties: writeCapabilities: [] - name: ChatInputBarConfiguration.KeyboardKeyCode summary: | - Determines an additional key users can press to trigger focusing on the - default chat input bar. + Additional key users can press to trigger focusing on the default chat + input bar. description: | - Determines an additional key users can press to trigger focusing on the - default chat input bar. Useful when you want to have an extra hotkey for - focusing in addition to the "/" key. + Additional key users can press to trigger focusing on the default chat + input bar. Useful when you want to have an extra hotkey for focusing in + addition to the / key. code_samples: [] type: KeyCode tags: [] @@ -221,12 +217,10 @@ properties: writeCapabilities: [] - name: ChatInputBarConfiguration.PlaceholderColor3 summary: | - Determines the color of the text of the placeholder text in the default - chat input bar. + Color of the text of the placeholder text in the default chat input bar. description: | - Determines the color of the text of the placeholder text in the default - chat input bar. Default value is - `Datatype.Color3|Color3.new(178, 178, 178)`. + Color of the text of the placeholder text in the default chat input bar. + Default value is `Datatype.Color3|Color3.new(178, 178, 178)`. code_samples: [] type: Color3 tags: [] @@ -246,8 +240,6 @@ properties: summary: | A reference to the target `Class.TextChannel`. description: | - A reference to the target `Class.TextChannel`. - Determines which `Class.TextChannel` to use when the user sends a message with the default chat input bar. code_samples: [] @@ -267,28 +259,27 @@ properties: writeCapabilities: [] - name: ChatInputBarConfiguration.TextBox summary: | - A reference to a designated `Class.TextBox` Instance that sends messages - on behalf of the user. This property only accepts TextBox instances. + Reference to a designated `Class.TextBox` instance that sends messages on + behalf of the user. description: | - A reference to a designated `Class.TextBox` Instance that sends messages - on behalf of the user. This property only accepts TextBox instances. - - You can use it to further integrate your custom chat input bar UI into - your experience by freely manipulating appearance, location, and layout. - When opting to set this property to a custom TextBox, you don't need to - write any code for the following behavior: + Reference to a designated `Class.TextBox` instance that sends messages on + behalf of the user. You can use it to further integrate your custom chat + input bar UI into your experience by freely manipulating appearance, + location, and layout. When opting to set this property to a custom + `Class.TextBox`, you don't need to write any code for the following + behavior: - When a user types a message and presses `Enum.KeyCode.Return`, the message will be sent to `Class.ChatInputBarConfiguration.TargetTextChannel`. - When a message is sent, `Class.TextBox.Text` will automatically clear. - For security, some limitations are imposed on the TextBox when it is - promoted to `Class.ChatInputBarConfiguration.TextBox`. Lua code will not - be able to: + For security, some limitations are imposed on the `Class.TextBox` when it + is promoted to `Class.ChatInputBarConfiguration.TextBox`. Lua code will + not be able to: - Change the `Class.TextBox.Text` property. - - Use the `Class.TextBox.CaptureFocus` or `Class.TextBox.ReleaseFocus` + - Use the `Class.TextBox:CaptureFocus()` or `Class.TextBox:ReleaseFocus()` methods. code_samples: [] type: TextBox @@ -307,10 +298,10 @@ properties: writeCapabilities: [] - name: ChatInputBarConfiguration.TextColor3 summary: | - Determines the color of the text in default chat input bar. + Color of the text in default chat input bar. description: | - Determines the color of the text in default chat input bar. Default value - is `Datatype.Color3|Color3.new(255, 255, 255)` (white). + Color of the text in default chat input bar. Default value is + `Datatype.Color3|Color3.new(255, 255, 255)`. code_samples: [] type: Color3 tags: [] @@ -328,10 +319,9 @@ properties: writeCapabilities: [] - name: ChatInputBarConfiguration.TextSize summary: | - Determines the size of the text in default chat input bar. + Size of the text in default chat input bar. description: | - Determines the size of the text in default chat input bar. Default value - is 14. + Size of the text in default chat input bar. Default value is `14`. code_samples: [] type: int64 tags: [] @@ -349,10 +339,10 @@ properties: writeCapabilities: [] - name: ChatInputBarConfiguration.TextStrokeColor3 summary: | - Determines the color of the text stroke of text in default chat input bar. + Color of the text stroke for text in default chat input bar. description: | - Determines the color of the text stroke of text in default chat input bar. - Default value is `Datatype.Color3|Color3.new(0, 0, 0)` (black). + Color of the text stroke for text in default chat input bar. Default value + is `Datatype.Color3|Color3.new(0, 0, 0)`. code_samples: [] type: Color3 tags: [] @@ -370,11 +360,10 @@ properties: writeCapabilities: [] - name: ChatInputBarConfiguration.TextStrokeTransparency summary: | - Determines the transparency of the text stroke of text in default chat - input bar. + Transparency of the text stroke for text in default chat input bar. description: | - Determines the color of the text stroke of text in default chat input bar. - Default value is 0.5. + Transparency of the text stroke for text in default chat input bar. + Default value is `0.5`. code_samples: [] type: double tags: [] diff --git a/content/en-us/reference/engine/classes/ChatWindowConfiguration.yaml b/content/en-us/reference/engine/classes/ChatWindowConfiguration.yaml index f4eb59f3e..8e0a698e1 100644 --- a/content/en-us/reference/engine/classes/ChatWindowConfiguration.yaml +++ b/content/en-us/reference/engine/classes/ChatWindowConfiguration.yaml @@ -5,9 +5,8 @@ memory_category: Instances summary: | Configures properties of the default chat window. description: | - Configures properties of the default chat window. - - It is parented to `Class.TextChatService`. + Configures properties of the default text chat window. It is parented to + `Class.TextChatService`. code_samples: [] inherits: - TextChatConfigurations @@ -17,8 +16,7 @@ deprecation_message: '' properties: - name: ChatWindowConfiguration.AbsolutePosition summary: | - Describes the actual screen position of the default chat window, in - pixels. + Actual screen position of the default chat window, in pixels. description: | Read-only property that provides the screen position of the default chat window in pixels. Behaves similarly to `Class.GuiBase2d.AbsolutePosition`. @@ -41,7 +39,7 @@ properties: writeCapabilities: [] - name: ChatWindowConfiguration.AbsoluteSize summary: | - Describes the actual screen size of the default chat window, in pixels. + Actual screen size of the default chat window, in pixels. description: | Read-only property that provides the screen size of the default chat window in pixels. Behaves similarly to `Class.GuiBase2d.AbsoluteSize`. @@ -64,13 +62,13 @@ properties: writeCapabilities: [] - name: ChatWindowConfiguration.BackgroundColor3 summary: | - Determines the background color of the default chat window. + Background color of the default chat window. description: | - Determines the background color of the default chat window. If the - background color is not overridden, this value will respect the user's + Background color of the default chat window. If the background color is + not overridden, this value will respect the user's `Class.GuiService.PreferredTransparency` by making the menu more gray as the transparency of the menu decreases. Default value is - `Datatype.Color3|Color3.new(25,27,29)`. + `Datatype.Color3|Color3.new(25, 27, 29)`. code_samples: [] type: Color3 tags: [] @@ -88,13 +86,13 @@ properties: writeCapabilities: [] - name: ChatWindowConfiguration.BackgroundTransparency summary: | - Determines the background transparency of the default chat window. + Background transparency of the default chat window. description: | - Determines the background transparency of the default chat window in a - number between 0 and 1. This value is multiplied with the user's + Background transparency of the default chat window as a number between `0` + and `1`. This value is multiplied with the user's `Class.GuiService.PreferredTransparency` to create the effective background transparency used by the chat window, which may be more opaque - than this value set here. Default value is 0.3. + than this value set here. Default value is `0.3`. code_samples: [] type: double tags: [] @@ -112,11 +110,9 @@ properties: writeCapabilities: [] - name: ChatWindowConfiguration.Enabled summary: | - Determines whether to show the default chat window. + Whether to show the default chat window. description: | - Determines whether to show the default chat window. - - Set to `false` to hide the default chat window. + Whether to show the default chat window. Set to `false` to hide. code_samples: [] type: bool tags: [] @@ -134,9 +130,9 @@ properties: writeCapabilities: [] - name: ChatWindowConfiguration.FontFace summary: | - Determines the font used to render text in the default chat window. + Font used to render text in the default chat window. description: | - Determines the font used to render text in the default chat window. + Font used to render text in the default chat window. Default is `Enum.Font.BuilderSansMedium`. code_samples: [] type: Font tags: [] @@ -154,12 +150,11 @@ properties: writeCapabilities: [] - name: ChatWindowConfiguration.HeightScale summary: | - Determines by what factor the height of the default chat window should be - scaled. + Factor by which the height of the default chat window should be scaled. description: | - Determines by what factor the height of the default chat window should be - scaled. Must be a value between 0.5 and 2. Defining a value outside of - range clamps the actual value to the closest bound. + Factor by which the height of the default chat window should be scaled. + Must be a value between `0.5` and `2`. Defining a value outside of range + clamps the actual value to the closest bound. code_samples: [] type: float tags: [] @@ -177,13 +172,15 @@ properties: writeCapabilities: [] - name: ChatWindowConfiguration.HorizontalAlignment summary: | - Determines the horizontal alignment of the chat window. + Horizontal alignment of the chat window. description: | - Determines the horizontal alignment of the chat window. Behaves similarly - to `Class.UIGridStyleLayout.HorizontalAlignment`. Setting to `Left` or - `Right` adding a small padding away from touching the corresponding - horizontal edge of the screen. Setting to `Center` aligns the window in - the horizontal middle of the screen. Default value is `Left`. + Horizontal alignment of the chat window. Behaves similarly to + `Class.UIGridStyleLayout.HorizontalAlignment`. Setting to + `Enum.HorizontalAlignment|Left` or `Enum.HorizontalAlignment|Right` adding + a small padding away from touching the corresponding horizontal edge of + the screen. Setting to `Enum.HorizontalAlignment|Center` aligns the window + in the horizontal middle of the screen. Default value is + `Enum.HorizontalAlignment|Left`. code_samples: [] type: HorizontalAlignment tags: [] @@ -201,10 +198,10 @@ properties: writeCapabilities: [] - name: ChatWindowConfiguration.TextColor3 summary: | - Determines the color of the text in default chat window. + Color of the text in default chat window. description: | - Determines the color of the text in default chat window. Default value is - `Datatype.Color3|Color3.new(255, 255, 255)` (white). + Color of the text in default chat window. Default value is + `Datatype.Color3|Color3.new(255, 255, 255)`. code_samples: [] type: Color3 tags: [] @@ -222,10 +219,9 @@ properties: writeCapabilities: [] - name: ChatWindowConfiguration.TextSize summary: | - Determines the size of the text in default chat window. + Size of the text in default chat window. description: | - Determines the size of the text in default chat window. Default value - is 14. + Size of the text in default chat window. Default value is `14`. code_samples: [] type: int64 tags: [] @@ -243,10 +239,10 @@ properties: writeCapabilities: [] - name: ChatWindowConfiguration.TextStrokeColor3 summary: | - Determines the color of the text stroke of text in default chat window. + Color of the text stroke for text in default chat window. description: | - Determines the color of the text stroke of text in default chat window. - Default value is `Datatype.Color3|Color3.new(0, 0, 0)` (black). + Color of the text stroke for text in default chat window. Default value is + `Datatype.Color3|Color3.new(0, 0, 0)`. code_samples: [] type: Color3 tags: [] @@ -264,11 +260,10 @@ properties: writeCapabilities: [] - name: ChatWindowConfiguration.TextStrokeTransparency summary: | - Determines the transparency of the text stroke of text in default chat - window. + Transparency of the text stroke for text in default chat window. description: | - Determines the color of the text stroke of text in default chat window. - Default value is 0.5. + Transparency of the text stroke for text in default chat window. Default + value is `0.5`. code_samples: [] type: double tags: [] @@ -286,13 +281,15 @@ properties: writeCapabilities: [] - name: ChatWindowConfiguration.VerticalAlignment summary: | - Determines the vertical alignment of the chat window. + Vertical alignment of the chat window. description: | - Determines the vertical alignment of the chat window. Behaves similarly to - `Class.UIGridStyleLayout.VerticalAlignment`. Setting to `Top` or `Bottom` - adds a small padding away from touching the corresponding edge of the - screen. Setting to Center aligns the window in the vertical middle of the - screen. Default value is `Top`. + Vertical alignment of the chat window. Behaves similarly to + `Class.UIGridStyleLayout.VerticalAlignment`. Setting to + `Enum.VerticalAlignment|Top` or `Enum.VerticalAlignment|Bottom` adds a + small padding away from touching the corresponding edge of the screen. + Setting to `Enum.VerticalAlignment|Center` aligns the window in the + vertical middle of the screen. Default value is + `Enum.VerticalAlignment|Top`. code_samples: [] type: VerticalAlignment tags: [] @@ -310,12 +307,11 @@ properties: writeCapabilities: [] - name: ChatWindowConfiguration.WidthScale summary: | - Determines by what factor the width of the default chat window should be - scaled. + Factor by which the width of the default chat window should be scaled. description: | - Determines by what factor the width of the default chat window should be - scaled. Must be a value between 0.5 and 2. Defining a value outside of - range clamps the actual value to the closest bound. + Factor by which the width of the default chat window should be scaled. + Must be a value between `0.5` and `2`. Defining a value outside of range + clamps the actual value to the closest bound. code_samples: [] type: float tags: [] @@ -333,8 +329,14 @@ properties: writeCapabilities: [] methods: - name: ChatWindowConfiguration:DeriveNewMessageProperties - summary: '' - description: '' + summary: | + Creates a new `Class.ChatWindowMessageProperties` instance that can be + used to customize the appearance of messages in the chat window. + description: | + Creates a new `Class.ChatWindowMessageProperties` instance that can be + used to customize the appearance of messages in the chat window. + `Class.ChatWindowMessageProperties` inherits from + `Class.TextChatMessageProperties`. code_samples: [] parameters: [] returns: diff --git a/content/en-us/reference/engine/classes/ChatWindowMessageProperties.yaml b/content/en-us/reference/engine/classes/ChatWindowMessageProperties.yaml index 1a7efc4dc..6c73e7727 100644 --- a/content/en-us/reference/engine/classes/ChatWindowMessageProperties.yaml +++ b/content/en-us/reference/engine/classes/ChatWindowMessageProperties.yaml @@ -12,8 +12,10 @@ tags: deprecation_message: '' properties: - name: ChatWindowMessageProperties.FontFace - summary: '' - description: '' + summary: | + Font used to render text in the chat window. + description: | + Determines the font used to render text in the chat window. Default is `Enum.Font.BuilderSansMedium`. code_samples: [] type: Font tags: [] @@ -30,8 +32,10 @@ properties: - Chat writeCapabilities: [] - name: ChatWindowMessageProperties.PrefixTextProperties - summary: '' - description: '' + summary: | + Determines the properties of the `Class.TextChatMessage.PrefixText|PrefixText` preceding the chat message. + description: | + Determines the properties of the `Class.TextChatMessage.PrefixText` preceding the chat message. code_samples: [] type: ChatWindowMessageProperties tags: [] @@ -48,8 +52,10 @@ properties: - Chat writeCapabilities: [] - name: ChatWindowMessageProperties.TextColor3 - summary: '' - description: '' + summary: | + Color of the text in the chat window. + description: | + Determines the color of the text in the chat window. Default value is `Datatype.Color3.new(255, 255, 255)` (white). code_samples: [] type: Color3 tags: [] @@ -66,8 +72,10 @@ properties: - Chat writeCapabilities: [] - name: ChatWindowMessageProperties.TextSize - summary: '' - description: '' + summary: | + Size of the text in the chat window. + description: | + Determines the size of the text in the chat window. code_samples: [] type: int tags: [] @@ -84,8 +92,10 @@ properties: - Chat writeCapabilities: [] - name: ChatWindowMessageProperties.TextStrokeColor3 - summary: '' - description: '' + summary: | + Stroke color applied to text in the chat window. + description: | + Determines the stroke color applied to text in the chat window. Default value is `Datatype.Color3.new(0, 0, 0)` (black). code_samples: [] type: Color3 tags: [] @@ -102,8 +112,10 @@ properties: - Chat writeCapabilities: [] - name: ChatWindowMessageProperties.TextStrokeTransparency - summary: '' - description: '' + summary: | + Transparency of the stroke applied to text in the chat window. + description: | + Determines the transparency of the stroke applied to text in the chat window. Default value is `0.5`. code_samples: [] type: double tags: [] diff --git a/content/en-us/reference/engine/classes/TextChatMessageProperties.yaml b/content/en-us/reference/engine/classes/TextChatMessageProperties.yaml index 3481048d3..49428a2ea 100644 --- a/content/en-us/reference/engine/classes/TextChatMessageProperties.yaml +++ b/content/en-us/reference/engine/classes/TextChatMessageProperties.yaml @@ -9,16 +9,8 @@ summary: | description: | Overrides `Class.TextChatMessage` properties when returned by callbacks defined in `Class.TextChatService.OnIncomingMessage` or - `Class.TextChannel.OnIncomingMessage`. - - `Class.TextChatMessageProperties` overrides the matching properties of the - corresponding `Class.TextChatMessage`. - - This can be used to customize the appearance of a message with rich text tags. - See [Rich Text Markup](../../../ui/rich-text.md) for more. - - To learn more about using TextChatMessageProperties, see - [In-Experience Text Chat](../../../chat/customizing-in-experience-text-chat.md). + `Class.TextChannel.OnIncomingMessage`. This can be used to customize the + appearance of a message with [rich text](../../../ui/rich-text.md) tags. code_samples: [] inherits: - Instance @@ -66,8 +58,10 @@ properties: - Chat writeCapabilities: [] - name: TextChatMessageProperties.Translation - summary: '' - description: '' + summary: | + The `Class.TextChatMessage.Translation` to override. + description: | + The `Class.TextChatMessage.Translation` to override; represents [automatically translated](../../../production/localization/automatic-translations.md) and filtered text messages based on players' localization settings. code_samples: [] type: string tags: [] diff --git a/content/en-us/reference/engine/classes/TextChatService.yaml b/content/en-us/reference/engine/classes/TextChatService.yaml index d5c7a4508..803a214c7 100644 --- a/content/en-us/reference/engine/classes/TextChatService.yaml +++ b/content/en-us/reference/engine/classes/TextChatService.yaml @@ -435,17 +435,33 @@ callbacks: capabilities: [] writeCapabilities: [] - name: TextChatService.OnChatWindowAdded - summary: '' - description: '' + summary: | + Called when a new message is about to be displayed in the chat window. + This can only be implemented on the client. + description: | + Called when a new message is about to be displayed in the chat window. + This can only be implemented on the client. + + Use this to customize individual messages that appear in the chat window. + If this callback returns a `Class.ChatWindowMessageProperties`, those + properties will be applied to the associated message, overriding + `Class.ChatWindowConfiguration` properties. If a `Class.UIGradient` is + parented under `Class.ChatWindowMessageProperties`, it will also override + the `Class.ChatWindowConfiguration.TextColor3|TextColor3` property defined + in `Class.ChatWindowConfiguration`. code_samples: [] parameters: - name: message type: TextChatMessage default: - summary: '' + summary: | + The incoming `Class.TextChatMessage`. returns: - type: Tuple - summary: '' + summary: | + If a `Class.TextChatMessage` is returned, those properties will be + applied to the associated message, overriding + `Class.ChatWindowConfiguration` properties. tags: [] deprecation_message: '' security: None