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

Trying to make a button that clears text?

Box = game.StarterGui.ScreenGui.Frame.Chatbox

function leftClick()
Box.Text = ""
end
 
function rightClick()
Box.Text = ""
end
 
script.Parent.MouseButton1Click:Connect(leftClick)
script.Parent.MouseButton2Click:Connect(rightClick)

Layout:

Error: None

I am trying to make it when someone clicks the button it clears all text in the textbox

4 comments

0

Do you have Chatbox set to a variable?

0

No

0

https://i.gyazo.com/69664a93143c7f7bf1845c756abe6655.png is the layout did not show up in the original post for some reason

0

Just added the variable and I get no errors this time but still does not work

1 answer

✓ Accepted answer

First things first, you should be using local for your variables and functions e.g. local Box

Secondly, you will want to use a LocalScript inside the TextButton as it will be run by the client.

Finally, you can reference the Chatbox from the LocalScript itself by doing local Box = script.Parent.Parent.Chatbox

2 comments

0

That worked thanks!

0

No problem!

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