Page 1 of 1

mod_gui without children

Posted: Thu Feb 06, 2025 11:53 pm
by kurtzilla
My mod uses mod_gui and I place button elements in the top gui - button_flow
There are cases where I would like to have the ability to toggle the display of my mods buttons and I have that worked out

...Except, when I turn my mod's display (mod.destroy()) I am left with essentially, a top gui artifact. The empty frames are being drawn and I can't figure out the proper way to either remove or make not visible, let alone a good/better way to detect the empty inner_frame than a bunch of if statements walking the top gui structure to determine that the top gui is indeed empty.


Before:
Screenshot 2025-02-06 164817.png
Screenshot 2025-02-06 164817.png (480.26 KiB) Viewed 439 times

After:
Screenshot 2025-02-06 165202.png
Screenshot 2025-02-06 165202.png (71.35 KiB) Viewed 439 times

More detail:
Screenshot 2025-02-06 165239.png
Screenshot 2025-02-06 165239.png (1.03 MiB) Viewed 439 times

Re: mod_gui without children

Posted: Fri Mar 14, 2025 6:07 pm
by yaim904
Hi, can you share the code to do some tests?
It doesn't have to be everything, just the essentials.

Re: mod_gui without children

Posted: Fri Mar 28, 2025 4:51 am
by 0n0w1c
I have the same issue and also failed to find a good solution.

Edit: {Persistence}

Code: Select all

for _, player in pairs(game.players) do
    for _, root in pairs({ player.gui.top, player.gui.left }) do
        local artifact = root.mod_gui_top_frame
        if artifact and artifact.valid then
            artifact.destroy()
        end
    end
end