How to make a textbox clear after clicking a button?

I have an application center, and I’m using the same textbox for “long answers” and whenever you submit a long answer, and go to the next one I need it so the answer from the previous question isn’t shown.

2 Likes

YourTextBox.Text = “”

Maybe try that.

2 Likes

Connect a .MouseButton1Click event to your button and set the text of your TextBox to "".

Code:

--//Change variable references if needed
local Frame = script.Parent
local Button = Frame.Button
local TextBox = Frame.TextBox

Button.MouseButton1Click:Connect(function()
	TextBox.Text = ""
end)
2 Likes

So this does clear the textbutton, but doesn’t move onto the next question, code.

--//Change variable references if needed
local Frame = script.Parent
local Button = script.Parent.Parent.TextButton
local TextBox = Frame.TextBox

Button.MouseButton1Click:Connect(function()
	TextBox.Text = ""
end)
2 Likes

How are you sending the responses for collection? Like a RemoteEvent, dictionary, etc? I need to know that so I can find a way to achieve what you want to do.

Also, you can use Frame instead of script.Parent again.

Code:

local Frame = script.Parent
local Button = Frame.Parent.TextButton
local TextBox = Frame.TextBox

Button.MouseButton1Click:Connect(function()
	TextBox.Text = ""
end)
2 Likes

Just via webhook, that’s all, and thank you.

2 Likes

Are you sending a RemoteEvent to the server and then the server fires that webhook? Do you already have a system in place for that?

2 Likes

yes
i love the devforum so much it is so cool!

1 Like

Then just fire that RemoteEvent before you clear the text.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.