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

MenuScreen is not a valid member of ScreenGui? [Unsolved]

Asked by
Bman8765 270 Moderation Voter
10 years ago

Okay this is probably the dumbest script in the world but why wont it work. Whenever I test it the console outputs MenuScreen is not a valid member of ScreenGui and it says it is happening on line 3. This is a localscript named MenuScript and it is located inside of a ScreenGui named MenuGUI which is inside of StarterGui, there is another screen GUI but it is not in starterGui it is in serverstorage for another script. Here is the code:

local ScriptParent = script.Parent
local MenuIcon = ScriptParent.MenuButton
local MenuPopUp = ScriptParent.MenuScreen
MenuPopUp.Visible = false

Basically it is suppose to turn MenuScreen invisible but it wont work and it is weird, I can't seem to pick up anything with my eyes so if you have a suggestion to what that error is meaning and why it is happening that would be awesome. (This is just the beginning of the script, this isn't all it will do. I don't want to code anymore until I fix the simple bugs I already come across)

2 answers

Log in to vote
2
Answered by 10 years ago

Try naming the locals to something other than the name of the object you are trying to find.

0
If that still doesn't work let me know TheStudentPilot 75 — 10y
0
Still getting the same error, I changed the code above to what I now named the variables. Please tell me if these still are too similar. Bman8765 270 — 10y
0
A couple things... is your "MenuScreen" directly inside of script.Parent? Try script.Parent.MenuScreen.Visible = false. Also, try doing ScriptParent:WaitForChild("MenuScreen") ... this will pause the script until MenuScreen has been found. Let me know if you are still getting errors. TheStudentPilot 75 — 10y
0
Hahaha, maybe I should open my eyes more often. MenuScreen is nothing I have no clue why I was searching for that, changed it to the proper item and works just fine, thanks! Bman8765 270 — 10y
0
You are welcome! I'm glad I could help! I'm glad you got this figured out! TheStudentPilot 75 — 10y
Ad
Log in to vote
0
Answered by 10 years ago

If it is in starter GUI it will go into the players gui when they log on so you need to change that.

0
Something like script.parent? Bman8765 270 — 10y
0
ya CaptainRuno 40 — 10y
0
Still getting the same error Bman8765 270 — 10y
0
Like I have said I do have another GUI named StartingScreen located in ServerStorage if that means anything. Bman8765 270 — 10y

Answer this question