DelnRDev
(DelnRDev)
September 5, 2020, 5:16am
#1
i want the “PetName” have different color , what do i do
local StarterGui = game:GetService("StarterGui")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Player = game.Players.LocalPlayer
local RarityColor = {
["Common"] = Color3.fromRGB(95, 255, 21),
["Uncommon"] = Color3.fromRGB(25, 255, 248),
["Rare"] = Color3.fromRGB(255, 144, 33),
["Legendary"] = Color3.fromRGB(255, 0, 4)
}
ReplicatedStorage.UnboxedServerMSG.OnClientEvent:Connect(function(PetRarity, PetName)
StarterGui:SetCore("ChatMakeSystemMessage",{
Text = "[System] "..Player.Name.." unboxed a"..PetName,
})
end)
Maybe use a gradient? I can’t think of anything else. Not even sure that would work.
DelnRDev
(DelnRDev)
September 5, 2020, 5:41am
#3
no i just want the “PetName” have different color
AFAIK you can’t accomplish this with Roblox’s chat GUI at the moment since you aren’t able to edit the TextLabel variables to enable RichText.
You can create your own chat system that has RichText enabled in order to create this though - here’s a link with more information:
[Update Dec-02-2020]
[Update Sep-17-2020]
What is RichText?
Rich text uses simple markup tags to style individual words or phrases within a single string of text. Initially, we will provide font size, color, bold, italics, underline and strikethrough.
We plan on adding additional style options in future updates.
How do I use it?
First of all, enable rich text beta feature in studio.
Enable the Beta Feature To enable the beta feature:
Go to File - Beta Features in studio
Check the …
Doqee
(Doqee)
September 5, 2020, 12:55pm
#5
You’d have to check the PetRarity from the table, and change the Colour of ChatMakeSystemMessage
by inputting Color = PetRarity from Color3
, just like you did with the text.
To have more clarification of what you can do with that event, see :SetCore() .
As @Imp_erator stated, as of current, it’s not possible to seperate the colours in a sentence using SetCore, but you can try using RichText with TextLabels instead.