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

How do I retrieve a textbox text???

Every time I do the following it prints blank.

I have a screengui and inside that a textbox and a button. This script is inside the button. Everytime I print the data, everytime I click the button it always prints nothing. I do have text entered in the textbox.

local TextBox = script.Parent.Parent.TextBox

script.Parent.MouseButton1Click:Connect(function() -- Sorry if my spelling was wrong, doing this from head.
	local Data = TextBox.text
	print(Data)
end)

2 comments

0

Capitalize the t in text after TextBox (line 4).

0

"-- Sorry if my spelling was wrong, doing this from head."

1 answer

✓ Accepted answer

I'm assuming this script is a Server Script, correct? The reason it prints blank is because when you type in the TextBox, you're typing your text from your client, and on the server it's going to remain blank. So in order for this to work you'll need to change your Server Script to a Local Script so it can actually read the text you are inputting into the TextBox.

4 comments

0

This script is not in the server script service instead its a regular script and I mentioned where it is parented under. I will try using a local script. I did not know that you can't print from the client. This may or may not work. Well Ima try using a localscript now.

0

IT WORKED !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ????????????????????

0

Oof my emojis didnt show.

1

I wasn't asking where it was parented. 'Regular Scripts' are also called 'Server Scripts' because they handle things on the server, whereas local scripts handle things on the client.

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