What's the Deal with Regular Scripts in PlayerGui?

So I had a brief disagreement with a fellow developer about regular scripts in GUIs.

I was under the impression that regular scripts might not function correctly, and editing UI components with these regular scripts could be prone to exploits.

However, upon testing it, I learned that when I altered the UI component, the script ran normally, not recognizing my change on the UI component.

This leads me to my question: What’s the deal and use of regular scripts in GUIs? (For clarification, I was under the impression that regular scripts should not have been used under UIs)

Regular scripts represent the server. Guis are client-side and should be controlled by LocalScripts. Just because something works, doesn’t necessarily mean you should use it. All Gui work should be handled by the client and them alone.

In addition to the above, clients already all control elements of the Gui engine: the API, various events and all are fired off by the client. These changes aren’t seen by the server, so having an unaffiliated party attempt to look at changes they don’t know exist is also silly.

I don’t know what the other developer’s stance on this matter is but they’re correct in disagreeing with you about putting scripts on Guis, wholly.


Thank you for the answer.
My stance was that the scripts should’ve been replaced with LocalScripts, however, it appears that regular scripts work as well in the instance we were discussing over. Could that be explained somehow?

There’s something called server and client strain, too many things done on the server can crash the server, disconnecting all clients. While using a local script makes it so that it is computed on the client, giving the server less strain But, then, what about the client? The client, surprisingly, can handle much more than the server.

It’s just a product of the replication model. The server is responsible for populating the PlayerGui with StarterGui’s contents with respect to the ResetOnSpawn property. Again, regular scripts work, but that doesn’t mean they should be used, because the server doesn’t have the fullest extent of knowledge about how clients are managing Guis. It’s unreliable. Never use scripts with Guis.