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

Trying to make a button that clears text?

Asked by 4 years ago
Edited 4 years ago
01Box = game.StarterGui.ScreenGui.Frame.Chatbox
02 
03function leftClick()
04Box.Text = ""
05end
06 
07function rightClick()
08Box.Text = ""
09end
10 
11script.Parent.MouseButton1Click:Connect(leftClick)
12script.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

0
Do you have Chatbox set to a variable? ThatDevTim 188 — 4y
0
No DevSeveral 19 — 4y
0
https://i.gyazo.com/69664a93143c7f7bf1845c756abe6655.png is the layout did not show up in the original post for some reason DevSeveral 19 — 4y
0
Just added the variable and I get no errors this time but still does not work DevSeveral 19 — 4y

1 answer

Log in to vote
0
Answered by
Memotag 226 Moderation Voter
4 years ago
Edited 4 years ago

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

0
That worked thanks! DevSeveral 19 — 4y
0
No problem! Memotag 226 — 4y
Ad

Answer this question