GuiService.MenuOpened not working?

So I’m fixing up/polishing a 2016 ui remake of roblox’s coregui, I was trying to make the settings button/hamburger button go blue when the menu opens but It just wasn’t working, heres my code:

	local function toggleSettings()
		if GuiService.MenuOpened then
			settingsIconImage.Image = "rbxasset://textures/ui/Menu/HamburgerDown.png"
		else
			settingsIconImage.Image = "rbxasset://textures/ui/Menu/Hamburger.png"
		end
	end

yes I have other code but this just aint working, any fix?

It’s an event, you’re treating it as a property.

Create a MenuOpened event connection for the HamburgerDown image and create a MenuClosed event connection f or the Hamburger image

1 Like

So like this?

	local function toggleSettings()
		GuiService.MenuOpened:connect(function()
			settingsIconImage.Image = "rbxasset://textures/ui/Menu/HamburgerDown.png"
		end)
		
		GuiService.MenuClosed:connect(function()
			settingsIconImage.Image = "rbxasset://textures/ui/Menu/Hamburger.png"
		end)
	end
1 Like

Yep, should work, though I’d use Connect instead of connect as the latter is deprecated.

If it still doesn’t work, ensure it is in a localscript

I fixed it up a bit (and yes its all in a local script) thanks so much!!!

1 Like