So basically, I have a shop GUI and I want to have it so that you can close out of it before walking away. The problem is that if you close the window before walking away, you end up triggering the part that pops it up again. Is there a way to negate this?
LocalScript that closes it (Programs the close button.)
--Code by EnderVolts local playergui = game.Players.LocalPlayer.PlayerGui local gui = playergui.appliances_gui print("Script for closing the Appliance Gui succesfully started") local function closeGui() --Defines a function that sets the shop's ScreenGui to disabled. gui.Enabled = false print("Closed Appliance GUI") end script.Parent.MouseButton1Click:connect(closeGui) --Makes it so that when you click the 'x' button it triggers closeGui()
LocalScript that opens it (Programs invisible part to open the Gui.)
--Code by EnderVolts local playergui = game.Players.LocalPlayer.PlayerGui local gui = playergui.appliances_gui print("Script for closing the Appliance Gui succesfully started") local function closeGui() --Defines a function that sets the shop's ScreenGui to disabled. gui.Enabled = false print("Closed Appliance GUI") end script.Parent.MouseButton1Click:connect(closeGui) --Makes it so that when you click the 'x' button it triggers closeGui()