Hi! I recently came across an amazing system that is able to send a chat message with different colored text. How would that work? As far as I know, you can only use one color.
I’m sure they messed with the chatModules, but where does the ChatModules hold the functions such as ChatMakeSystemMessage?
The system:
What i’ve got:
game.ReplicatedStorage.SendAnnouncement.OnClientEvent:Connect(function(txt)
print("posting announcement")
wait(1)
game.StarterGui:SetCore("ChatMakeSystemMessage", {
Text = txt;
Font = Enum.Font.Cartoon;
Color = Color3.fromRGB(245,50,120);
FontSize = Enum.FontSize.Size96;
})
end)
I just can’t find a way because there’s only one color section, is there a formatting or such? ( Such as, | colored text | uncolored text? )
Do you mean like have half of it a certain color, like [System] and the message? If thats what you mean, I think you can only make it one Color if you are using this method.
I found this solution on the web, and it does indicate as I said you cannot use multiple colors on SetCore, but you can make a custom script. Here is the post;
Just note that the above doesn’t explain how to change colours, only how to add a bot speaker to the chat. You should be able to do this without forking anything or even using the Lua Chat System folders. Even if you do, just insert a BoolValue named InsertDefaultValues and check it off so that the other modules load; no need to fork them too.
Everything you’re looking for is available in the Lua Chat System documentation, specifically ChatSpeaker. You’ll have to go a little ways to do this. Simply; create a new speaker and add their data.
Creating a module in ChatModules or using an external script has relatively the same solution. The difference is that ChatModules have ChatService passed to them, while an external script needs to wait for the ChatService.
Structures for your code:
-- ChatModule
local function Run(ChatService)
-- Code
end
-- External script
local ChatService = require(game:GetService("ServerScriptService"):WaitForChild("ChatServiceRunner").ChatService)
Once you have the ChatService in either method, the rest becomes straight forward. Add a speaker and give them different colours as you want. What you’re seeing here is a name and chat colour.
local speaker = ChatService:AddSpeaker("Announce")
speaker:JoinChannel("All") -- Does NOT join all channels! Only the global one.
speaker:SetExtraData("NameColor", BrickColor.new("Lime green").Color)
speaker:SetExtradata("ChatColor", BrickColor.new("Persimmon").Color)
speaker:SayMessage(".announce <global> <popup> <anon> <message>", "All")