No, .Activated is an Event. You need to refer to the Button.
the menu button frame? or which button because textbutton doesnt work
wait do you mean the script that it is in? wait noā¦
I recommend you check out the developer hub on stuff like guis and variables so you dont get confused.
i realized that there were errors in the output. it says:
Visible is not a valid member of LocalScript āStarterGui.Menu.MenuButtonFrame.TextButton.ButtonScriptā - Client - ButtonScript:7
why dont you copy paste the diagram?
The problem here is that you donāt know how to correctly reference the Frames. Below is a diagram I made to help you understand. Hereās what you need to know:
-
To make this script work, you need to change the first 2 lines. The first line should be the Frame you want to show, and the second should be the Frame you want to hide.
-
The white arrow is not used in this script, but itās just there to help you understand what
.Parent
means. Whenever you write.Parent
, you go up in the hierarchy, as shown in the picture. Essentially, itās what is holding the object you are mentioning. In this case, ScreenGuiās Parent is StarterGui, because ScreenGui is inside of StarterGui. -
Now, weāll take a look at the code thatās highlighted in green. First, we start by writing
script
, which tells the game to go to the script that is being ran (our code is located inside of TestScript). Next, we have.Parent
3 times. This tells the game to go up 3 times, meaning it will go to MyButton, because TestScript is inside of it, then it will go to EpicFrame, because MyButton is inside of it, next it goes to ScreenGui, because EpicFrame is inside of it, and finally Info, because itās inside of ScreenGui. Basically, every green arrow except the first and the last is another.Parent
-
Moving on to the code that is highlighted in blue. Again, we start at the script, and this time we just go up twice, because thereās
.Parent
2 times. So, we would go to MyButton and then to EpicFrame. -
Finally, the code that is highlighted in red. Here, we start at the script and we go up a single time. This would refer to MyButton, because our script is inside of it.
-
So, to sum up: when you write
script
, you are starting from the script in which you are writing. When you write.Parent
you go up once, meaning you go to whatever is holding the object previously mentioned. When you want to refer to an object, just use itās name! By the way, if something has spaces in its name (e.g. āNice Frameā), you need to put it in brackets. It would become["Nice Frame"]
instead of just.NiceFrame
If you have any questions, be sure to tell me. Here is the diagram:
frame i want to show is basically everything, i wanna hide menuframe tho with exit button
so i just copy paste that script you put (image) in every single localscript, ok
No, you need to change the first two lines, otherwise it will error. Use script
, .Parent
, and the names of your Frames to refer to them.
OHHHHHHHHHH. i think i need to first put script, parent, then the frames and then the gui right
Yes, you start with script.Parent
, and then go up to the Frames you want by adding more .Parent
or by adding their names.
wait a second⦠studio doesnt want to refer to the frames
studio thinks its false whenever i type in the names after putting āscript.Parentā
You might need to add multiple .Parent
. Take my picture as an example. If I want to refer to Info
, I canāt just say script.Parent.Info
, I need to keep adding .Parent
until I reach the object thatās holding it, which is ScreenGui.
oh, i think this worked
local toShow = script.Parent.Parent.Parent.Parent.Menu
so it ends at the gui, right? i think
i would guess i need to copy paste this:
local toShow = script.Parent.Parent.Parent.Parent.Menu
over and over
Exactly! You go all the way up to the GUI, and then you just put the Frameās name. Be sure to also update toHide, which is the thing you want to hide.
time to test if it works! i really hope it works.