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

how to change textlabel text color with a variable?

basically just trying to change the text in the text label with a variable. this is the error

attempt to index string with 'TextColor'

local color = character.UpperTorso.BrickColor
TextLabel.Text.TextColor3 = color

1 comment

1

BrickColors have a Color property.

2 answers

✓ Accepted answer

Problem

You're attempting to index a string with a function, this would not work because functions cant be referenced by a string. - Unless with a type of function.

Another problem is that you cannot use BrickColors with a text. Because a brickcolor is a property of a 3D dimensional object.

Solution:

You'd have to use this function to change textlable colors. TextLable.TextColor3.

Fixed script

local color = character.UpperTorso.Color3
TextLabel.TextColor3 = color

1 comment

0

ah, ok I see what I messed up on. the error I'm getting now is "Color3 is not a valid member of MeshPart"

You can't mix BrickColor and Color3 together, as it would break your script. Instead, get the Color3 values from the character and then use TextLabel.TextColor3

local color = character.UpperTorso.Color3 --This gets 3 values.
TextLabel.TextColor3 = color

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