Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 4 years ago

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
0
No, they are the same thing. I prefer using Visible more, its easier. Delude_d 112 — 4y
0
delude you do realise the poster is https://scriptinghelpers.org/user/ScriptingHelpersSucs pokemonzizzle8383 6 — 4y
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. wiva15 0 — 4y
0
Frame:Destroy() sends the frame right to the garbage collector, whereas making it invisible will keep it on the screen, but, well, invisible. DeceptiveCaster 3761 — 4y
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. Delude_d 112 — 4y

2 answers

Log in to vote
0
Answered by
haba_nero 386 Moderation Voter
4 years ago

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!

Ad
Log in to vote
0
Answered by
aredanks 117
4 years ago

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.

Answer this question