Accessing GUIs from Server-side or Client-side?

Hey everyone,

I have a quick question about using GUIs and the PlayerGui.

I just want to understand the basics of accessing GUIs through scripts and how they should be accessed. Ok so, If I want to change a player’s Gui (TextLabel Text) using PlayerGui would I do it from the server or client-side?

Through my experience with being a new developer, it should be accessed from the client-side. But, I’m pretty sure you can access it from the server-side too. I don’t understand the difference in accessing them from the server-side and client-side. (Why do we use both instead of just client-sided local scripts?)

  • I want to know if it’s better to access it from the client-side or server-side
  • Why do we access it from the server-side sometimes?

I have made many practices games and I have changed all the players Gui’s from the server and client-side and I don’t see a difference.

This is a fairly simple topic, but I want to understand it perfectly as it will help me in the development of games and more cool stuff.

Once again, I’m a new developer still learning the basics.

Thanks in advance,

3 Likes

In my experience, any manipulation of GUI elements should be done solely by the client, with the exception of invoking the client to do so by the server. If the client has a very high ping, then it would take an annoying amount of the time for the client to interact with the GUI and for the server’s response to get sent back, resulting in a terrible user experience.

4 Likes

Thanks for sharing this information with me, I will keep all this in mind.

1 Like

I shall go over everything I know about GUIs. I hope this helps you figure this out.

Server Side

A GUI can somewhat be controlled through the Server Side, depending on what you mean. (i.e; You want to give the GUI to a certain person, a Server Side Script can duplicate that GUI from Server Storage to those said players.) However, any GUIs that use the Server Side can change EVERYTHING AND ANYTHING for everyone. The Server Side is what everyone sees.

Client Side

A GUI is able to be controlled through the Client Side, depending on what you mean. (i.e; You want to remove something from Workspace.) However, any changes made from the Client Side won’t register to the Server Side which is good as that is what everyone sees when they join your game.

Client & Server Side Working Together

There is one way that the Server Side & Client Side works together to do certain things and that’s two items called Remote Events & Remote Functions. You can use the said items to have the Client talk to or make changes to the Server.

What is recommended

What is recommended is that you keep GUIs on the Client side as if someone gets ahold of your Server Side GUI, they can do a lot of things to change your game.

Extra Note

If you need to use both Server and Client Side, I would strongly recommend putting a Admin Check for each Server Side thing you do so that way if someone who isn’t supposed to have the said GUI can’t do changes without being an Admin.
Yes, this is possible… I’ve done it.

I hope this helps you with your issue(s). Respond if you have any questions.

8 Likes

I talked about this before on this thread as well:

Same response here pretty much.

3 Likes

There is no reason for the server to mess with GUIs. User interface has always been something only one player would see. If you do it on the server that defeats the purpose of its changes replicating to all.

Also make sure to search.

3 Likes

Thanks for the in-depth GUI explanation, I learned something that I didn’t know and this will definitely help me in my future development.

2 Likes

Thank you, this is helpful too.

2 Likes

The comment section had good examples and logic of accessing GUIs. Thanks.

1 Like

It is preferably done client sided for GUI interactions, it is best for the user to not encounter lag with the GUI. For example you wanna make a health bar, you don’t want it to lag and such, or you want a button click you don’t want the player to experience delays if they are lagging. It’s also easier to script GUIs with local scripts in my opinion.

1 Like

Hmm thanks, will keep that in mind.

I don’t understand why someone would access a GUI from the server, the way I do it is I do all the important functions and value setting on the server and update the actual GUI client side. So, even if they change it, the client cant replicate to the server.

1 Like

Thanks a lot, I get exactly what you’re saying.

The main reason people use a GUI to access the Server Side is mainly to make changes such as the time, lighting, ambient, fog… etc.

2 Likes