Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Changing a TextLabel's Text Color? [Solved]

I'm trying to have a tooltip script that displays a player's name in a GUI when another player hover's their mouse over them, and have red text when it's an enemy player, but apparently Color3.new() doesn't work for TextColor3. So, does anyone know how this line should be rewritten?:

TextLabel.TextColor3 = Color3.new(255, 254, 205)

2 answers

✓ Accepted answer

You would use Color3.new, but the R, G, and B values in Color3.new range from 0 - 1. Basically, you would write your code like this:

TextLabel.TextColor3 = Color3.new(255/255, 254/255,205/255) --It's dividing the numbers by 255 to scale the value to a number between 0 and 1

4 comments

0

Huh, that's misleading of them... Never would have realized that the values had to be within a range of 0-1

0

Yeah I know it's weird

0

It's not within a range of 0-1. It's 0-255 :P

0

zMatrix65831, in case you do not know, scripts read Color3 as 0-1.

If you have a lot of Color3 values you need to put in your code, you can paste this code at the top of your script to be able to use a 0-255 range.

local _Color3 = Color3
local Color3 = { new = function(r, g, b) return _Color3.new(r/255, g/255, b/255) end }

TextLabel.TextColor3 = Color3.new(25, 50, 75)

This discussion is preserved as it was. New answers, comments, and votes are closed.