Problem for enable a ScreenGUI using an imageButton

Hello this is my problem.
I would like that when I press the Imagebutton, the “ScreenGUI” to be enabled or disabled, but nothing happens.

Here is my code:

-- << Services >> --

-- << Variables >> --
local button = script.Parent
local menuToOpen = game.StarterGui.SpeedObbyGame.MenuGUI
-- << Functions >> --

-- << Connections >> --
button.Activated:Connect(function()
	if menuToOpen.Enabled == true then
		menuToOpen.Enabled = false
	elseif menuToOpen.Enabled == false then
		menuToOpen.Enabled = true
	end
end)

And a screenshot of the 2 repertory:
image
Thanks.

local button = script.Parent
local menuToOpen = script.Parent.Parent.Parent.MenuGui -- try to make this way

Using “game.StarterGui.SpeedObbyGame.MenuGUI” ure only trying to open template of this gui not Player’s gui.
– << Functions >> –

1 Like

You need to set the property in the playergui, and not in the startergui

1 Like

Thanks, it works. And thanks also for the explaination.