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 make a Textbox change text in a script?

How would I make a Textbox change text in a script and what i mean by that is If you had a Textbox on a gui and when you press a textbutton any thing that you typed in there will print into the console or something

2 comments

1

We need an attempt.

0

You just do [textbox.Text = "Your string"] I can only assume your issue is the TextBox only exists on the client because it was created locally, in that case you need a LocalScript to handle the change (which is advisable to have either way)

1 answer

Use a LocalScript and connect the MouseButton1Click property of the TextButton to a function that prints the contents of a TextBox.

Example object hierarchy:

StarterGui

ScreenGui

TextButton, TextBox, LocalScript

Example LocalScript:

local box = script.Parent.TextBox
local button = script.Parent.TextButton

button.MouseButton1Click:Connect(function()
print(box.Text)
end)

1 comment

1

here so u get 200

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