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.
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.
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.
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.
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.
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.