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 its text once a TextButton is pressed?

I am quite new to scripting, and found nothing on this online.

1 answer

Connect a function to the event that is fired upon the button being clicked, which will set the text.

We'll use the following:

MouseButton1Click event of TextButton. See in the docs

Text property of TextBox. See in the docs

Like so:

-- Connect a function to the event, so that it will run every time the event fires
YourButton.MouseButton1Click:Connect(function()
    YourTextBox.Text = "Whatever text you want here" -- Set the Text property, changing the text shown
end)

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