Script prints too many times on TextBox Text Change

Hello devs,
I have a simple script set up which prints the text that is inputted into it.
Every time the text changes, the script will print what the text is changed to.
However, whenever I change the text in the textbox, the script prints multiple times, even though the text only changed once.
Output:
image

Here is my code:

script.Parent.Changed:Connect(function()
	print(script.Parent.Text)
end)

use .InputChanged it detects every time when its changed (self-explanatory)

.Changed fires every time some property of the textbox changes, be it AbsolutePosition, TextBounds, state changes (such as input), and so forth, as you can see by printing the modified property.

script.Parent.Changed:Connect(print)

You might want to only listen to Text changes.

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

Works.
image

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.