Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Is Destroying a gui or parenting it somewhere else better than doing Visible = false?

So im tryna reduce lag and all but I was wondering if destroying a gui is better than Setting the gui To False

for example a frame you'd do

Frame:Destroy()

or 

Frame.Visible = false

5 comments

0

No, they are the same thing. I prefer using Visible more, its easier.

0

delude you do realise the poster is https://scriptinghelpers.org/user/ScriptingHelpersSucs

0

If your trying to "reduce lag", then Destroying it is better, because if you set the Visible to false, the object is still there.

0

Frame:Destroy() sends the frame right to the garbage collector, whereas making it invisible will keep it on the screen, but, well, invisible.

0

wiva15. I am pretty sure destroying and setting the visibility to false is the same thing. If you set the visiblity to false the pc or client doesnt have to "render" the GUI.

2 answers

Try setting the GUI Gui.Enabled == false this will prevent the GUI from doing anything. But if its scripts that are causing lag, try script.Disabled = true. Hope this helps you in solving lag!

Destroying a GUI removes its existence thus is not requiring any resources to have scripts in it run for it.

Setting a GUI invisible only sets it invisible so scripts will run in it normally as if it was visible.

What is the answer? It's dependent on what local scripts are doing in your GUI, you can disable the GUI, disable scripts, destroy it, and whatever you want to it but it is better to destroy the GUI otherwise if you do not care about making it visible again, but if you want to use it again then you'd have to just disable the GUI or tick off visibility before enabling it (GUI/Visibility) again.

This discussion is preserved as it was. New answers, comments, and votes are closed.