Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
3

How to add multiple colors to one string?

Asked by
CodyDev 70
6 years ago

I've been attempting to create a radio system and I want to have the name a different color than the spoken text. The problem is that isn't really possible by just configuring properties, so I need help.

The first thing I thought of was having two different TextLabels, where one is the name and the other is the message. However if their name is too long to fit inside the name box, it will become smaller.

What I want: Image (Done automatically by a script)

What I don't want to happen: Image

1
TextService:GetTextSize() lets you measure the dimensions of some text. You can use this to calculate the size of the first part of the text, then offset the second part of the text by that size. Optikk 499 — 6y
0
Thanks. I haven't tried it yet but I'm sure that'll work. CodyDev 70 — 6y
0
Ok, I finished it earlier so thanks again. Also those images above are in the wrong order for anyone else looking here. CodyDev 70 — 6y

1 answer

Log in to vote
2
Answered by
Kullaske 111
6 years ago

You would have to use this

0
Or TextLabel.TextBounds Amiaa16 3227 — 6y
Ad

Answer this question