Example of a StringValue have colored text:
A StringValue has the value “This text is red”
The same StringValue has an attribute, Color.
The Color attribute is a color type attribute, and its value is 255, 0, 0
When a TextLabel’s text is set to the StringValue’s value, the TextLabel’s TextColor is also set to the Color attribute of the StringValue.
If you need a code sample, just let me know.
If you are setting a TextLabel’s text to the value of the StringValue, you can just change the TextColor3 property of the TextLabel. StringValues are only to hold the string itself, if you want to have more properties use Attributes or interpret the color depending on how you display it to the player.
No problem!
Ok, so this would be the code (hopefully, I haven’t tested it. Let me know if it errors)
local function setTextLabelToStringValue(textLabel, stringValue)
textLabel.Text = stringValue.Value
if stringValue:GetAttribute("Color") then
textLabel.TextColor3 = stringValue:GetAttribute("Color")
end
end
-- You can name the function whatever you want, by the way
Then, to do this you would just add a Color type attribute named “Color” to a StringValue.
This function can be run with any TextLabel and StringValue, just run the function as setTextLabelToStringValue(<insert text label here>, <insert string value here>)