How do I detect what the user typed?

Hi everyone! So I have a text box UI, one of those UI’s that allow users to type something inside of the UI, and I’m wondering how to detect what they typed. I’m trying to create a password system. For example, the user enters “Password” which is correct, they get access, if they type anything other than “Password”, block access.

1 Like

You would simply check the TextBox’s Text property. If you wanted to check every time the value changed instead of a submit button, you could also use TextBox:GetPropertyChangedSignal("Text"):Connect(function()


Thank you! The problem here is, when I create a variable to save what the user entered, I can only call the variable inside of the function, here, see.

local Text = script.Parent

local MainGui = script.Parent.Parent

local EnterButton = MainGui.TextButton

Text.PlaceholderText = "Create a Password"

EnterButton.Text = "Create!"


local PasswordSave = Text.Text


EnterButton.Text = "Saved Password!"




if Text.Text =


This should be expected, as the scope of that variable is that function you put it inside. If you needed the value outside of that function, define the value outside or use return to send the value outside of that function.

1 Like