Is it inefficient to leave every GUI element in a ScreenGui, but with Visible = false?

Currently, I have my games set up so that every GUI element the player will ever interact with is inside their PlayerGui in a ScreenGui. When it’s supposed to be shown, I set Visible to true, and when it’s not, Visible is false.

Is this inefficient, or proper use? Should I be destroying them or parenting them elsewhere when they are not being used? Or does setting the Visible property to false sufficiently ‘halt’ any computationally intensive tasks that may be involved with keeping them in the player’s ScreenGui?

1 Like

I don’t think it’s inefficient, and can be very useful if you are creating an intro and need to remove all the guis temporarily or something like that.

I imagine that them being not visible removes them from the render pipeline to some degree, so really all it’s going to do is take up memory.

Creating/destroying is expensive, so keeping them around is ideal.

6 Likes

How does the amount of players make a difference? The GUIs should be handled locally by the client, not by the server.

1 Like

Still, how does this make a “huge” difference between using ScreenGuis and toggling the property of GUI elements?

And how does simply having a lot of players cause GUI lag? The server needs to keep up with the players, but the client just minds its own business. If the game becomes laggy because of the amount of players, then you should not worry about “creating/destroying” GUIs over making them invisible instead, because clearly something else is causing the issue.

Huh?

Guis don’t lag because server-sided code can’t be ran in them. The server has nothing to do with interfaces except handling replication to clients (either via StarterGui or manually cloning Guis yourself). Character physics are replicated directly from the client. Input is handled only from the client and so are PlayerScripts (again, besides replication).

The only slowdown provided by players is unoptimised code and character humanoids which are, by nature, expensive (to which there are plans to mitigate this with upcoming updates announced at RDC).

For your information, MeepCity runs 125 player servers with little to no lag. Please do some research or test before making untrue assertions.

2 Likes