I recently started to try things in lua and i came across something i cant seem to find out. I also tried searching it on google but since i dont really know how to formulate it correctly im having a bit of a hard time with it. (I'm sorry if the title isnt clear, i couldnt think of a good way to explain/ask the question.)
So, i got the following script as a example. As you see i made a variable for "startmenu" Now when i run the game i get the following output: StartMenu is not a valid member of PlayerGui. I dont really get the problem since StartMenu is a member of StarterGui? I'm trying to open the Screen Gui "StartMenu" from a localscript that is located inside the "SideMenu" folder, i thought it would be possible to open it this way or is it impossible and do i need to find another way?
startmenu = script.Parent.Parent.Parent.StartMenu
local button = script.Parent
local toggled = false
local function onButtonActivated()
if toggled == false then
startmenu.Visible = true
print ("open") -- prints if succesfully opened
toggled = true
else
print ("closed") -- prints if succesfully closed
toggled = false
end
end
button.Activated:Connect(onButtonActivated)
My StarterGui is looking like this: (i made it a code block so the tabs work)
StarterGui
LoadingScreen (Screen Gui)
SideMenu (Screen Gui)
ImageButton
Local Script
StartMenu (Screen Gui)
Thanks in advance!

3 comments
Which line is the error?
If you're available, could you take a look at my proposition?
I revised the pathway code, try it again!