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 check the text labels text?

local text = TextLabel.Text

I tried to do it this way but it doesnt work.

1 answer

✓ Accepted answer

Doing it that way will work in a sense, but probably not the way you intend it to. When you add .Text, you're getting the Text within that TextLabel at that given moment. So if you store it in a variable, that's like doing local text = "Hi". It won't change unless you do it via script. If you want to be able to always have the current Text of the TextLabel, you'll need to access it's Text property each time you want to use it... So:

local TextLabel = script.Parent.TextLabel -- Wherever it's located

print(TextLabel.Text)
wait(5)
print(TextLabel.Text)

The above is just an example if you were to enter something different within those 5 seconds. If you want to be able to know anytime the Text is changed (Assuming it's a TextBox since a TextLabel can only change text via script), you can use the Changed event and check the Text, GetPropertyChangedSignal to specify for the Text property, or even FocusLost on the TextBox itself. Have fun!

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