Text Color Change Script

Hey! I am Domderp999. I am having problems with Color3 on a TextLabel.


Could somebody explain why this errors?

3 Likes

What’s the error you’re getting?

I dont get an error… Its weird.

Can we see more of the code please because there is nothing wrong with this part of the code.

Oops! It appears I found the issue. It was under a fire event, I thought the changing color part was the part that failed.

1 Like

If you show the code i may be will be able to solve it.

Umm I don’t know any scripts, so I’ll remake it from scratch.

On a local script and the parent is the Textlabel

script.Parent.TextColor3 = Color3.fromRGB(0,0,255) -- change to anything
script.Parent.TextStrokeColor3= Color3.fromRGB(0,255,0) -- change to anything

I tested and it worked, make sure its not a normal script because GUI runs on the client.

3 Likes

I think you should be using ‘Color3.new’ instead of ‘Color3.fromRGB’.

fromRGB should work too though.

1 Like

Anyways, it seems like the OP may have solved it.

1 Like

Do /255 on all of the values so for example

script.Parent.TextColor3 = Color3.new(255/255, 98/255, 98/255)
script.Parent.TextStrokeColor3 = Color3.new(168/255, 64/255, 64/255)
2 Likes

That’s no different from using the fromRGB constructor, which is much cleaner to read in code if you’re working with 0-255 values. In fact, that’s why the fromRGB constructor exists, so you can avoid doing this. You have to evaluate three division operations before the Color3 object is created.

1 Like

Use this :

script.Parent.TextColor3 = BrickColor.new(“name of the color”)
script.Parent.TextStrokeColor3 = BrickColor.new(“name of the color”)

4 years for see working comment, LOL :grinning: