I am having a issue with a ui overlapping unitl i realised i can use scripts (Issue)

so im having a issue with gui but i had a idea off making 1 gui open while the previous 1 closed but all it does is close it and not open the one i want it to here is the code:

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

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

I am new at coding

Something like this might work better, but it’s hard to know without more information about your project.

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

What information will help you please explain to me so i can go more in depth

Can you post an image of the Explorer window showing what things are called what and are children of what other things?

The code didnt work it did the same thing but sure here it is:

HSADAS

Where is the script, and what things are you trying to show/hide when what thing is clicked?

sdask

the arrow is showing where it is and it will open 1 frame and close the other

script.Parent.Parent.Visible = false

It’s making the “Games” Frame invisible, is that intentional?

There aren’t any things called Zocash, is that a typo? If you’re getting any errors in the console then please post those as well.

The issue is that Zocash is a child of script.Parent.Parent, therefore when disabling that GuiObject visibility, you also make Zocash invisible. For your script to work Zocash must be outside of script.Parent.Parent.

the games section is not meant to show their is a frame named Zocash -Edit looking closer i just realised it

How would i do that? reference the part before parent?

i did the edit and it didnt close the current ui the output says:

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

Sorry, I’m still super confused about what you’re trying to do xD Could you post an image of your GUIs and an explanation of what you want them to do?

so you click Buy zobucks it opens

and it closes the games page

1 Like

I see!

Here’s how you can do a tabbed layout:

local main = script.Parent
local tabBar = main.TabBar
local tabHolder = main.TabHolder

tabBar.Tab1Button.MouseButton1Click:Connect(function()
	tabHolder.Tab2.Visible = false
	tabHolder.Tab1.Visible = true
end)

tabBar.Tab2Button.MouseButton1Click:Connect(function()
	tabHolder.Tab1.Visible = false
	tabHolder.Tab2.Visible = true
end)

As for why your script is going wrong, it’s like I said you’re turning off the “Games” Frame, and as far as I can tell the Zobucks tab is a child of Games, so by doing so you also turn off the Zobucks tab.

i tried this script in output nothing happend so do i need to move where the guis are

Don’t use the file I sent you in your own project. It’s a ScreenGui, it’s meant to be put in StarterGui so you can see an example of how it could work.

would something like this work

local main = script.Parent
local tabBar = main.TabBar
local Open = main.TabHolder

tabBar.Tab1Button.MouseButton1Click:Connect(function()
tabHolder.GamesVisible = false
tabHolder.Zobucks.Visible = true

end)

tabBar.Tab2Button.MouseButton1Click:Connect(function()
tabHolder.Tab1.Visible = false
tabHolder.Tab2.Visible = true

end)

No, you need to set up both buttons. And you still have the same issue of having one tab be inside the other tab. If you do that, you can’t open and close them independently. So don’t have Zobucks inside Games, assuming those are the two tabs.

Can you send the model? Just right click it in the Explorer window, click save to file, and then drag/drop the file into a comment here on the forums.

Guis.rbxm (14.1 KB)