Dynamic client chat options
While setting up the config you may have noticed this section:
--== Settings for client-sided aspects of the chat in your game. ==--
ClientChatOptions = {
--== Default settings for your game's BubbleChat. Most of these values are dynamic and can be changed at any time. See here: https://crystalflxme.github.io/ChatPlus/setup/dynamic-client-chat-options/ ==--
BubbleChat = {
--== Not Dynamic | If enabled, bubble chat will show for players. ==--
Enabled = true,
--== The font for the BubbleChat ==--
Font = Enum.Font.SourceSans,
--== The font size for the BubbleChat. MUST FIT A FONTSIZE ENUM: https://developer.roblox.com/en-us/api-reference/enum/FontSize ==--
FontSize = 24,
--== The color of the text in the bubble. ==--
TextColor = Color3.fromRGB(0, 0, 0),
--== The background color of the bubble. ==--
BackgroundColor = Color3.fromRGB(255, 255, 255),
--== The max distance before chat bubbles say "..." ==--
NearBubbleDistance = 65,
--== The max distance before chat bubbles disappear. ==--
MaxBubbleDistance = 100
}
}
This is for changing any chat related settings for the client. Editing the client's chat options is made easy by the way ChatPlus works. Some values can be changed dynamically and they update in real-time. For example, if you changed the font under BubbleChat, the next chat bubble that is created will fit that formatting.
The only difference is to edit these values dynamically you have to edit a folder in ReplicatedStorage generated by ChatPlus that defaults to these settings found here.
For the values that are not dynamic (marked with "Not Dynamic"), like BubbleChat's enabled property, they do not update on the client when you change their value in ReplicatedStorage. They are values only checked on server start.
Editing them is this simple and can be done on any server script:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ClientChatOptions = ReplicatedStorage:WaitForChild("ClientChatOptions") -- Make sure to use WaitForChild!
-- Try chatting now and you'll see that the bubble chat will look like the settings you have in the module
wait(8)
ClientChatOptions.BubbleChat.Font.Value = Enum.Font.Arcade.Name
ClientChatOptions.BubbleChat.TextColor = Color3.fromRBG(255, 0, 0)
print("Changed the client chat options!")
-- Now, if you chat, the chat bubble will have red text and the Arcade font!
Make sure to keep in mind that editing these values isn't like the table in the module! You are editing value instances, so you have to add a .Value
to edit them correctly (as seen in the example above).
For Enum values, make sure to refer to their string name!
Enum.Font.Arcade.Name
-- OR
"Arcade"