I have a gui where it can toggle a menu, but I can't figure out how to make it show if it is toggled. This is the code for the parent:
local button = script.Parent local toggled = false local function onButtonActivated() if toggled == false then button.Image = "rbxgameasset://Images/Dropdown-active" toggled = true else button.Image = "rbxgameasset://Images/Dropdown-null" toggled = false end end button.Activated:Connect(onButtonActivated)
I have an idea. Create two "ImageLabel" Gui's in the same spot, one being the toggled image and one the non-toggled image. Then create a third Gui, this one a "ImageButton" Gui, and make it the same size and position as the two Image Label Guis. The Image Button should have a higher zindex than the Image Labels. Also, make the Image Button totally transparent. Then change your function so it makes the "ImageTransparency" of the desired toggled state Gui 0, and the other 1, making it appear as if the image has been changed.
local button = script.Parent local toggled = false local ToggledImage = -- Gui for the toggled image local NonToggledImage = -- Gui for the toggled image local function onButtonActivated() if toggled == false then ToggledImage.ImageTransparency = 0 NonToggledImage.ImageTransparency = 1 toggled = true else NonToggledImage.ImageTransparency = 0 ToggledImage.ImageTransparency = 1 toggled = false end end button.Activated:Connect(onButtonActivated)