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)
Error: None
I am trying to make it when someone clicks the button it clears all text in the textbox
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