Im trying to make a chat box that you can only see and type in this GUI im making. I have the basic layout:
StarterGui - ScreenGui(Named Global) - TextButton(Named General) - LocalScript and ScrollableFrame and in the frame a TextBox.
I need the TextButton (General) to be the one that toggles the Frame which then visible = true on TextBox...
Heres my code thats in the local script.
local scriptParent = game.StarterGui.GlobalChat.General local ToggleButton = game.StarterGui.GlobalChat.General local chatbox = game.StarterGui.GlobalChat.General.ChatBox local chattype = game.StarterGui.GlobalChat.General.ChatType ToggleButton.MouseButton1Down:connect(function() if chatbox.Visible then chatbox.Visible = false else chatbox.Visible = true end end)
Thanks :)
You can't use things StarterGui as a valid way for events and what not. The GUI in StarterGui is cloned into the player's GUIs so doing an event for when something is clicked in the StarterGui will have no effect.
local general = script.Parent --General is the scripts parent so you can just do this local chatbox = general.ChatBox general.MouseButton1Click:connect(function() if chatbox.Visible == true then chatbox.Visible = false else --Can only be true or false, so if not true, then it has to be false chatbox.Visible = true end end)