OK, this might seem like a silly question, but I have no idea of how to go about getting the player’s text input from a TextBox. How does one go about this?
11 Likes
Read the TextBox.Text
property (similar to TextLabels and TextButtons) as this is the property that is changed upon the user typing.
If you’d like to detect when the text is changed, use GetPropertyChangedSignal
on the Text property.
TextBox:GetPropertyChangedSignal("Text"):Connect(function()
-- Executes when the user adds/deletes a character or when the text is set via script.
end)
3 Likes
I thought about that, but in-game I changed the TextBox’s text in game and nothing changed. Hmm, I’ll actually try that in a script, then! Thanks for the quick reply!
2 Likes
If you want to keep track everytime the text is changed you can do
TextBox:GetPropertyChangedSignal("Text"):Connect(function()
end)
Ah, beat me to it
16 Likes
local TextBoxObject = whatever
TextBoxObject.Text --> simple
There’s also other neat tricks on the side if you’re interested.
TextBoxObject:CaptureFocus()
TextBoxObject.FocusLost
The text property updates when players type into it, but the property doesn’t replicate. You must handle this from a LocalScript (or rather should).
4 Likes
OK. Thanks for the quick replies everyone!
3 Likes