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

How do I change the text in TextLabel to a variable?

Asked by 6 years ago
Edited 6 years ago

So, I would actually call myself experienced in Lua. However, I somehow never took the time to learn how to change TextLabel text to a Variable. ( Just to let you know, I do know how to change TextLabel text itself) I thought it would be something like...

examplevariable = 100

textlabel.Text = "examplevariable"

However, it's not. It just changes it to "examplevariable". How would one do this?

1 answer

Log in to vote
1
Answered by 6 years ago

Hey OrcaTheFish,

The solution to your question is not one to be much complicated so, this answer should not be long. Alright, so a Gui's text is a String, now you don't need to worry much about making your text a String because every time you set a number as the Text in a Gui it auto-matically converts to a String. If you don't believe me you can get a Gui's text and use the type() method to check if it's a String or a Number. Anyways, now that we're past that, time to get into setting a Gui's text to a variable you might have. You simply set a value for the variable and then you set the Text property of the Gui Object equal to the variable. Below is a personal example of this.

Personal Example

local var = 100;

gui_object.Text = var;

Well, as you can see from the method above, it's really as simple as that.

I give you the best of my regards and live a life you can be proud of. I'll cya next time.

~~ KingLoneCat

0
longer than necessary, lol, but answers the question well dragonkeeper467 453 — 6y
0
Thanks, I always like to answer a question formally so that's why it's long. KingLoneCat 2642 — 6y
Ad

Answer this question