Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do I make a TextBox change its text once a TextButton is pressed?

Asked by 2 years ago

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

1 answer

Log in to vote
1
Answered by
Aimarekin 345 Moderation Voter
2 years ago

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)
Ad

Answer this question