How to update the value to be displayed on TextLabel using values input by the players on a TextBox

Hello! I’m sorry if this looks unorganized. I am not that good at scripting and this is my very first post in the DevForum and I would appreciate your help ^^

  1. What do you want to achieve?
    I want to display whatever the player has put in the textbox on a textlabel

  2. What is the issue?
    Here’s a local script on one of the TextBox

    When I try to call it on the main local script, it only prints nil
    it only prints nil

  3. What solutions have you tried so far?

  • I used FocusLost event in a local script inside the textbox and under it is a string value so that I can “try” to change the value of the string value by overwriting it with the TextBox.Text but it didn’t work

  • I also found this video on Youtube: How to Change the Text of a Gui - Roblox Studio - YouTube but it only seems to work when the text I want to display is already determined by myself.

  1. You have to access the local player’s PlayerGui, not StarterGui, otherwise you change it for the next time the player respawns.

  2. You should have Results be MainGui.Results and not the Text property of it, as it sets Results to be a string of what the text is, thus making “print(Results.Text)” print nil. Because .Text isn’t a valid thing of a string. Which is all Results is because you set Results to a different string, QuadTerm.Value

Also, if you’re trying to change the text of the Results (TextLabel?) you’ll want to set the Results variable to the TextLabel and not the .Text property, as this sets the Results variable to the string of the current text. Then when you set Results = QuadTerm.Value, you’ll do Results.Text = QuadTerm.Value

1 Like

Thankk you! I was able to clear the nil part now. The “TextLabel” part is the GUI itself, I want to be able to display the the Results as the value displayed by the TextLabel