Textbox isn't changing Text

For some reason, the TextBox’s Text isn’t changing.

Button.MouseButton1Click:Connect(function()
	TextBox.Changed:Connect(function()
		print("TextBox changed Text")
	end)
end)

Is this being handled on a Server or Local Script? Might need to change it to Local if that’s the case

You want to focus the textbox when the button is clicked?

Try using :CaptureFocus on the textbox, then it should focus the textbox and the text will be able to be changed. You can also just click on the textbox.

@Jackscarlett, It is a Local Script inside a TextButton.

Better separate the functions:

local Click = false
Button.MouseButton1Click:Connect(function()
    Click = true
end)
TextBox.Changed:Connect(function()
    if Click then
        print("TextBox changed Text")
    end
end)
1 Like

@SOTR654 , For some reason it didn’t work.

Put print(“Click”) below this line:

and this print(Click) below this other:

If the second does not print or is false or if neither is printed, something is preventing the script from continuing.

Try this

TextBox.Changed:Connect(function()
print("TextBox changed text")
end)
Button.MouseButton1Click:Connect(function()
     TextBox.Text = "Change this into whatever you want"

end)

@hestolemyrice, Still doesn’t work.

Can you send what’s in before this, please.

1 Like

There is nothing before, it is just local variables.

Yeah but I don’t want to choose what the Textbox’s Text is going to be, basically there is a local script in a textbutton if you click on the textbutton it changes the text of a textbox.

wait wait what im confused are you using text box or text button

1 Like

This is weird xd
My script works, so the script is misplaced, not activated or if it has a :WaitForChild() its wait is infinite.

1 Like

You have to use GetPropertyChangedSignal

Button.MouseButton1Click:Connect(function()
	TextBox:GetPropertyChangedSignal("Text"):Connect(function()
		print("TextBox changed Text")
	end)
end)
1 Like
textbutton = script.Parent
Textbox = script.Parent.Parent.TextBox
Textbox:GetPropertyChangedSignal("Text"):Connect(function()
	print("TextBox changed Text")
end)

textbutton.MouseButton1Click:Connect(function()
	Textbox.Text = "insert text here"
	
end)

this should work

1 Like

If this is the entire script then it will not do anything.
If so, You can try to change the lines to the following:

Button.MouseButton1Click:Connect(function()
      TextBox.Text = "Insert Text Here"
      print("TextBox Changed Text")
end)

If this is just a part of the script, it would be better for you to give us your entire script, so we can see more details and we can help you even more!
Hope it helps!

1 Like