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

How do i detect a Gui Textbox changed?

My question is that, i'm trying to detect if a text of a TextBox is changed and i don't know a way of doing that. Im trying to do it so when a textbox text is changed it uses Instance.new to create as NumberValue and set the value to the text. If anyone could help thanks :)

1 comment

0

FocusLost and Focused or using what block mask said.

2 answers

Ok, so. Get familiar with the :GetPropertyChangedSignalChanged() function. This requires the property you want to be checked for, such as :GetPropertyChangedSignal("Text"), you then need to connect that to a function

Gui.Textbox:GetPropertyChangedSignal("Text"):Connect(function(textNow) --this function doesn't return anything, so "textNow" won't work
	textNow = Gui.Textbox.Text --refer to it back over here, now it will
	print(textNow)
end)

1 comment

0

Note that attempting to detect changes to the text on the server wont work; just wanted to point that out. c:

You can check if the text of a textbox has been changed using the :GetPropertyChangedSignal() event and setting the signal to check the text of the box.

Local Script under the TextBox

script.Parent:GetPropertyChangedSignal("Text"):Connect(function()
	print(script.Parent.Text)
end)

The above example prints the text of the box as it changes

1 comment

0

Fair well, Serpent

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