I can't get the text from a textbox

Hello! I was trying to create a system: if you click a button, it prints the text inside the textbox, but the error is that the output print the text at the start, not the new text wrote.

I tried with bindable events, nothing happened.

What do you guys suggest to do?

When I just click run instead of play it prints, else it prints the old text.

Show us your code please…

1 Like

Yeah, right.

Parent of the TextBox

script.Parent.Parent.Send.MouseButton1Click:Connect(function()
	script.Parent.Parent.Information:Fire(script.Parent.Text)
end)

Assign the value from BindableEvent to a number value

script.Parent.Information.Event:Connect(function(value)
	if tostring(value) then
		print("String, not a number")
	elseif tonumber(value) then
		script.Parent.Points.Value = value
	end
	
end)

The value rests 0, not with the new number.

I tried with focus lost, but it’s the same thing.

Okay first, never use bindable events they are useless here. Second, use TextBox.Changed and print the text to see if it prints accurately or not.

1 Like

What’s your hierachy???

1 Like

Same.
It prints nothing.

script.Parent.Changed:Connect(function()

	print(script.Parent.Text)
end)

It is a script.

Yeah your issue is that you are using a simple script, a simple script can’t see updates to a textbox. Use local scripts.

2 Likes

Don’t never use bindables. They are fine to use but in this situation they seem pointless but depends on script structure

1 Like

if you’re changing the text it would send the new text. You’re referencing the wrong object, simple as that.

2 Likes

Just please use an Event instead.

It can basically work the same as a Bindable (if you code it right).

1 Like

This is the original script before ask help:
Parent of the textbox:

script.Parent.FocusLost:Connect(function()
	local text = script.Parent.Text
	script.Parent.Parent.Information:Fire(script.Parent.Text)
end)
Change value:

script.Parent.Information.Event:Connect(function(value)
	if tostring(value) then
		print(":: Board Points :: Value is a string, not a number")
	elseif tonumber(value) then
		script.Parent.Points.Value = value
	end
	
end)
Script that send an event that fire points.
local value = script.Parent.Parent.Points.Value
script.Parent.MouseButton1Click:Connect(function()
	if script.Parent.Parent.Country.Value == "" then
		print(":: No button specified::")
	
else
print(value)
			script.Parent.Parent.Parent.Parent.Parent.Parent.Parent.API:Fire("Award", value)
			
	


end
end)


Okay but have you tried changing to a local script or not?

1 Like

What is your hierachy here??? Send a pic of your explorer

1 Like

Yeah, it kind of works, except you have to click off the textbox in order for it to actually execute the code. Still, pretty cool how you managed to type all that.

1 Like

image

1 Like

Broski you need a local script for that cause the server cant see client changes (just like kat said basically)

1 Like

Ok let me try, one second Katttt.

Yeah… finally…

1 Like

Are they all server scripts? I cant tell from the imaging. You need local scripts for UI. You’ll want to use RemoteEvents to communicate from a local to a server script in ServerScriptService. Don’t entirely know what you are tryna do

1 Like