Hey everyone. It's been a minute since I've coded in roblox studio. I'm trying to make it so a GUI enables and disables on the click of another button but it is failing to work for a reason completely unknown to me. Here is the code:
local button = script.Parent.ImageButton
local debounce = false
local browseBuyGUI = game.StarterGui.BrowseBuyGUI
local teleGUI = game.StarterGui.TeleportingToDealership
local function onButtonActivated()
if debounce == false then
if browseBuyGUI.Enabled == true then
browseBuyGUI.Enabled = false
teleGUI.Enabled = false
else
browseBuyGUI.Enabled = true
teleGUI.Enabled = true
end
debounce = true
wait(0.5)
debounce = false
end
end
button.Activated:Connect(onButtonActivated)
I have another script set to enable a blur effect whenever the browseBuyGUI is activated, and that works fine. The blur effect appears, but the GUI does not. This is a local script. Here is a picture of the hierarchy. (This same problem also happens with the teleGUI) Any help is appreciated, thanks.

3 comments
Is this a tool? Why are you using activated. Thats a value on tools.
^ it works on GuiButton's too - https://developer.roblox.com/en-us/api-reference/event/GuiButton/Activated
don't use StarterGui the StarterGui is not for player, use PlayerGui example, game.Players.LocalPlayer.PlayerGui