Skip to content

Commit 4e58a26

Browse files
authored
Added code snippet for deriving TextChatMessageProperties (#1048)
## Changes I was trying to figure out how to derive TextChatMessageProperites, and I couldn't find it anywhere. This PR aims to add a code snippet to the TextChatMessageProperties page ( https://create.roblox.com/docs/reference/engine/classes/TextChatMessageProperties ) that will show how to do so. ## Checks By submitting your pull request for review, you agree to the following: - [X] This contribution was created in whole or in part by me, and I have the right to submit it under the terms of this repository's open source licenses. - [X] I understand and agree that this contribution and a record of it are public, maintained indefinitely, and may be redistributed under the terms of this repository's open source licenses. - [X] To the best of my knowledge, all proposed changes are accurate. ---------
1 parent 515c0b0 commit 4e58a26

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

content/en-us/reference/engine/classes/TextChatMessageProperties.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,22 @@ description: |
1111
defined in `Class.TextChatService.OnIncomingMessage` or
1212
`Class.TextChannel.OnIncomingMessage`. This can be used to customize the
1313
appearance of a message with [rich text](../../../ui/rich-text.md) tags.
14+
15+
```lua title='LocalScript - Retrieving and Using TextChatMessageProperties'
16+
local TextChatService = game:GetService("TextChatService")
17+
18+
TextChatService.OnIncomingMessage = function(message: TextChatMessage)
19+
-- Derive chat message properties
20+
local properties = TextChatService.ChatWindowConfiguration:DeriveNewMessageProperties()
21+
22+
-- Change color of message
23+
properties.TextColor3 = Color3.fromRGB(255, 121, 121)
24+
25+
-- Set chat window message properties
26+
message.ChatWindowMessageProperties = properties
27+
28+
return properties
29+
end
1430
code_samples: []
1531
inherits:
1632
- Instance

0 commit comments

Comments
 (0)