Hello, I’m trying to make a word in a string appear in a certain color defined in ReplicatedStorage. For some reason, this word always appears black. Why?
Any help is appreciated.
local PartColor3 = game.ReplicatedStorage.Color.Value
local TransformedColor = Color3.fromRGB(PartColor3.R,PartColor3.B,PartColor3.G)
local FrontText = '<font color="#'..TransformedColor:ToHex()..'">'
local AfterText = "</font>"
script.Parent.Text = FrontText..Color.Name..AfterText.." will fall next"
Any context is appreciated. You need to show a script for us to be able to help in scripting support. What you’ve said has nothing to do with :ToHex().
Color values are between 0 and 1. The maximum color you can get from your code is #010101, which is near black. The fixed code is:
local Color = game.ReplicatedStorage.Color.Value -- Assuming Color3 here
local ColorName = BrickColor.new(Color).Name
local Label = script.Parent
local text= `<font color="#{Color:ToHex()}">{ColorName}</font> will fall next.`
Label.Text = text
the variable Color in this script refers to a part in the workspace. My game is centered on colours, I’m sorry for the confusion. PartColor3 is the variable that is the value of a Color3 value in the ReplicatedStorage.