From d19637503510695e1531fb16e776e1280a8b3186 Mon Sep 17 00:00:00 2001 From: MewMew Date: Wed, 8 Jan 2020 19:50:52 +0100 Subject: [PATCH] fix for panel destroying elements --- comfy_panel/main.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/comfy_panel/main.lua b/comfy_panel/main.lua index b05d32c4..5e803843 100644 --- a/comfy_panel/main.lua +++ b/comfy_panel/main.lua @@ -23,7 +23,13 @@ end function Public.comfy_panel_clear_left_gui(player) for _, child in pairs(player.gui.left.children) do - child.destroy() + child.visible = false + end +end + +function Public.comfy_panel_restore_left_gui(player) + for _, child in pairs(player.gui.left.children) do + child.visible = true end end @@ -115,6 +121,7 @@ local function on_gui_click(event) if event.element.name == "comfy_panel_top_button" then if player.gui.left.comfy_panel then player.gui.left.comfy_panel.destroy() + Public.comfy_panel_restore_left_gui(player) return else main_frame(player) @@ -124,6 +131,7 @@ local function on_gui_click(event) if event.element.caption == "X" and event.element.name == "comfy_panel_close" then player.gui.left.comfy_panel.destroy() + Public.comfy_panel_restore_left_gui(player) return end