Make More Then One Gui Hide When One Gui Is Clicked

Hey, I’m pretty new to scripting. I have made 4 guis that are supposed to be choose your spawn guis.

I am trying to make all the spawn guis dissapear when one is clicked. But I seem to only be able to hide the one clicked. How do I do multiple? When I do script.parent under that line I try to do game.startergui.frame1
I’m not sure what I’m doing wrong. Heres the script:

button = script.Parent
window = script.Parent.Parent.Parent.Parent

function onClicked(GUI)

Not sure if it’ll work but could try getting the parent by doing local ScreenGUI = script.Parent.Parent (to get the ScreenGUI) then getting all children of the ScreenGUI, then detecting when it’s clicked and then you could either use transparency or the delete service to hide it

You will need to localize the frames that you want to not be visible by using variables and to make them invisible just detect the Mouse Click event on the button:

local Frame = script.Parent:WaitForChild("Frame")
local Frame2 = script.Parent:WaitForChild("Frame2")
-- You can add more frames
local Button = script.Parent:WaitForChild("Button")

	Frame.Visible = false
	Frame2.Visible = false

Just doing game.StarterGui.Frame won’t work, it never does, you need to atleast get the service, if it still doesn’t work, use this method in the Frame ui as a localscript.
local sgui = script.Parent.Parent

Also use FindFirstChilds or use WaitForChilds to secure the script from breaking.
You also do not need a function here.