Is it ok to use scripts in GUI?

Hi,
my friend have new scripter, but when i gived him some work to test him, he puted (server) scripts to GUIs, so he musnt use remote events, something tells me, that it isnt best idea, but how bad it is?
Edit: (use case is GUI shop in players GUI folder)

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

0 voters

(1 = really bad, 10 = really good)
Edit 2: The poll is how good its compared to local script and remote event.

3 Likes

Depends on your use case. It is possible to have interactive server-sided SurfaceGuis for computer screens and such.

3 Likes

It was for GUI shop (so he musnt use remote to fire event at server script to give the player iteam and take the money).

If it’s for a local GUI in a player’s PlayerGui then it should use local scripts firing remote events.

3 Likes

Local scripts could take off some stress on the server. Although, global scripts are easier and won’t cause that many problems with the server as long as it is pretty simple. It honestly depends on what you’re doing.

1 Like

To add onto that, I would make most of it local sided if you’d want to go the extra mile. Use remote events for global events, like buying an item.

1 Like

There was even gui tween in the server script (so I think, its totaly ineffective).

Agreed with what @Twisted12Gaming is saying. Let the clients handle the shop GUI, and send any buy/sell requests through remote events. The server should then handle the actual transaction to prevent cheating.

2 Likes

It shouldn’t be that bad for the server and make it that laggy. Although, if the server is already stressed a lot from other game functions, then I would make the client handle most of the GUI.

1 Like

This isn’t a 1-10 kind of question to begin with; and to answer it at all, no, it’s really not.

Related:

3 Likes

For GUIS you should use localscripts. No need to do a poll.

4 Likes

Scripts won’t work on a player’s PlayerGui. Also, if it’s something that has to do with clicking a button, it has to be the client sending a remote. The activated event on TextButtons only fire on the client, the client should also be handling stuff in the PlayerGui. Even though the server can see a player’s PlayerGui, the server should never ever be touching it.

1 Like

Nope, scripts will work there as if every event will fire remote.

Server scripts only run if they are a descendant of the Workspace, ServerScriptService or a Backpack. If they do work in the PlayerGui, then that is most probably a bug, and will probably be fixed in the future.

1 Like

You should only use Local scripts for guis no matter what. Server scripts are unnecessary. The only time a server script comes to play is through a remote event where the server communicates to a local script, but the server script would be located in the server script service or the workspace, never the starter gui.

It is not a bug. It’s intended. It’s been like this for a long time.

2 Likes

Hmm, interesting, it isn’t documented on the Roblox Developer Hub,

I think, that its because its not recomended, but roblox dont want to break old games. Personally, I didn’t know about it, until the guy used it.

Then it’s basically deprecated, and should not be used
Edit: also, if roblox goes against this, it’s probably for a good reason, they created the API and know the internals and what should and shouldn’t be done

It is a bug. StarterGui elements are cloned locally into PlayerGui, so a script is cloned locally. That shouldn’t even work lol