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

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

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

✓ Accepted answer

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

2 comments

0

longer than necessary, lol, but answers the question well

0

Thanks, I always like to answer a question formally so that's why it's long.

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