Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do multi-color chat announcements work?

Asked by 6 years ago

Hello. I am making a GUI that lets admins announce anything into the chat anonymously, but I also want to replicate the multi-color that ROBLOX's official chat uses. The result I am looking for is:

(Red) [Game Announcement]: (white) This is a test announcement!

I know how to send the announcement to chat, using this code:

CreateMessage = function(text, color, font, size)
    game.StarterGui:SetCore("ChatMakeSystemMessage", {
    Text = text;
    Color = color;
    Font = font;
    FontSize = size;
    })
end

script.Parent.MouseButton1Click:connect(function()
    CreateMessage(game.Chat:FilterStringForBroadcast(script.Parent.Parent.TextBox.Text, script.Parent.Parent.Parent.Parent), Color3.new(255/255, 88/255, 88/255), Enum.Font.SourceSans, Enum.FontSize.Size24)
end)

but despite what I've tried, I can't seem to change the color. All of my results change the color of the entire message, not just part of it.

Is there any event/function I'm missing?

1 answer

Log in to vote
0
Answered by
H4X0MSYT 536 Moderation Voter
6 years ago

Textlabels / TextBoxes dont have individual colors. The instance will color the entire text as one color. You would need some fancy unicode work for multiple colors; by changing the position of multiple Instances based on the pixel width of the characters inside.

0
he wants to do that with chat Leamir 3138 — 6y
0
Oh. H4X0MSYT 536 — 6y
Ad

Answer this question