Issues with changing the colors in a TextLabel via scripting

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? I want the color from my TextLabel to change to a different color after a few seconds.

  2. What is the issue? I know how to make the “after a few seconds” part, just not the “color-changing” one.

  3. What solutions have you tried so far? I tried looking for tutorials on YouTube and also in the DevForum, but all of them were either about something else or simply did not work.

I’m REALLY new to scripting (and I mean it) but I really don’t know why this doesn’t work.

Wait(4)
script.Parent.TextColor3 = BrickColor.new("Really red")

PS: This is my first time posting on the Devforums so sorry if there’s some formatting issue or something like that.

This will be used in some sort of screen, the text starts off as black (to give it the impression that it’s not there) but after a few seconds it “turns on” (switches to red)

TextColor3 expects a Color3 type. It works a bit differently compared to BrickColor.
You can read up on Color3 here:

Also as a sidenote, I recommend you use task.wait() instead of wait(), it’s a bit more precise.

By the way, a little tip, you can put scripts into code blocks to make them highlighted like this:

wait(4)
script.Parent.TextColor3 = BrickColor.new(“Really red”)

Oh I think I get it, I’ll check it out, thanks!
Also, I’ll be using the highlight thing in the future, again, thanks.

1 Like

Why not just toggle the text’s visibility on/off if that’s what you’re trying to do?

There’s a property called TextTransparency.

Oh I didn’t know that, if the reply above doesn’t work then I’ll do that.
(Again, I’m very new to scripting lol.)

Feel free to ask any follow up questions, also if you actually want to hide the text there is another property called Visible that you can set to true or false.

Yes, but visible affects the whole text label. Not just the text.

Using TextTransparency instead also allows you to smoothly tween your text’s visibility.

task.wait(4)
script.Parent.TextColor3 = BrickColor.new("Really red").Color

I actually used that in the past for making a flickering light thingy, I thought it could only be used for parts though, I’ll keep that in mind, thanks!

Yeah I thought about it too but I decided not to question it, since well, I’m not exactly “qualified” lol.

Oh I didn’t even see that, I’ll definitively use a variation of that script if I need to.
Thanks!

TextColor3 is a Color3 value like someone said already, just after the equal sign use Color3.fromRGB(255,0,0) for a bright red but there will be a little color wheel for ya if you want to edit the color :slight_smile:

It depends on the desired effect. If you want to hide the text and the GUI element itself making it completely invisible and preventing it from obstructing other GUI elements Visible is the way to go. If you want to only hide the text @AlexPalex178’s suggestion to modify TextTransparency is the way to go in that case.

Interesting, pretty sure this will solve my issue then!
I’ll test it out so yeah, thanks for the help everyone!
On a Side-note, I had no idea the forums were THIS active… Though I suppose that’s good lol.

Yep this worked!
I made a simple script.

task.wait(4)
script.Parent.TextTransparency = 1

I was actually having some issues doing this… I’m just glad it’s finally over.
(I CAN FINALLY MOVE ON TO THE NEXT PART OF THE GAME!!!)

Edit: Forgot about task.edit, I’ll use it now.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.