Issue with opening a frame with button

So I’ve tried a lot of things but nothing has worked so my issue is clicking on a button to make the frame visible.

Code:

script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.Parent.StaterGui.Options.MainFrame.Visible = true
end)

Output:

StaterGui is not a valid member of PlayerGui “Players.3DRobloxGameDev.PlayerGui”

When the game starts StarterGuis are copied into the player’s PlayerGui, you probably wantscript.Parent.Parent.Parent.PlayerGui.Options.MainFrame.Visible

1 Like

I did this and this is the output says:

PlayerGui is not a valid member of PlayerGui “Players.3DRobloxGameDev.PlayerGui”

Then you might need one more .Parent

Still doesn’t work but the output says nothing

Try this:

script.Parent.MouseButton1Click:Connect(function()
    script.Parent.Parent.Parent.Options.MainFrame.Visible = true
end)
1 Like

That’s so weird its still saying nothing and not working…

can we see a screenshot of your explorer

explorer

where is your button located? (screen shot of that too please)

sorry for how messy it is its a tricky project (and i forget to name some things)

Try:

script.Parent.MouseButton1Click:Connect(function()
    script.Parent.Parent.MainFrame.Visible = true
end)

This didn’t work the output yet again says nothing

So there is a greater bug at play, I’m sure if you put a print statement in the connecting function it would print. Maybe the main frame is already visible, maybe you’re clicking the wrong open button.

Maybe the frame is visible but transparent

1 Like

Ok it does work but… There is also a close script to close it of course that’s where it seems to break it closes and you cant open it the 2nd time

Show us the close script please!

Ok Here is the close script:

script.Parent.MouseButton1Click:Connect(function()
script.Parent.Parent.Visible = false
end)

This would handle both opening and closing in one line.

Yes it would, I was going to suggest that, however based on the close script it seems the close script is in its own button in the main frame