I have tried string.color, but I realized that string.color isn't a thing anymore.
local TextLabel = script.Parent TextLabel.Text = "Hello" local TextToColor = string.find(TextLabel.Text, "He") TextToColor.Color3 = Color3.new(1, 1, 1)
I want the "llo" part in "Hello" to be black, and the "He" part to be white, but it always prints this:
"TextLabel.LocalScript:4: attempt to index number with 'Color3'"
The easiest way to change color for your text is TextColor3
Here's a script for you.
script.Parent.Text = "Hello" local TextToColor = string.find(TextLabel.Text, "He") TextToColor.TextColor3 = Color3.new(1, 1, 1,)
To change particular parts of text you need to use RichText, which you can enable on your TextButton/TextLabel/TextBox in the properties window. In order to make it a different color you would input something like so...
-- Turns 'He' red script.Parent.Text = '<font color="rgb(255,0,0)">He</font>llo'
Your example...
script.Parent.Text = '<font color="rgb(255,255,255)">He</font><font color="rgb(0,0,0)">llo</font>'