Should GUI scripts be in StarterPlayerScripts or in StarterGUI?

Most professionals say to put it in StarterPlayerScripts. I don’t know if that’s right though, is this true? Thanks.

(This is for modular scripting by the way, so is it best to put the local script in StarterPlayerScripts?)

Also should client modules be in replicated storage or in StarterPlayerScripts?

hey man for GUI scripts u put them in starterGUI!!!

i mean what u mean is module scripts right? so if ur doing a module script w say a localscript what i do is, i put my local script in Startergui and my module underneath the LS, if that makes sense.

i mean it depends on what ur trying to do, if its to do with the CHARACTER u put the LS in startercharscripts, for player, the other way around. if u want to script something w/ the mouse or userinput etc i put mine in startercharacter. i just prefer it that way but u find ur own niche

1 Like

Personally I put them in starterPlayerScripts, but I think its mostly personal preference. I do know that there is a performance benefit from not putting guis in starterGui, but I’m not sure if that carries over to the scripts as I believe starterPlayerScripts also replicates to all clients in a similar manner as StarterGui. So really it probably comes down to what you want to do and how you want to organize your project.

Edit: It might actually be good to just put the scripts inside the gui itself if they aren’t used for multiple guis.

i put them in startergui, cause it makes more sense to me, but do understand that the scripts get fired again when the player resets

What’s the difference between putting LocalScripts in PlayerGui and putting LocalScripts in PlayerScripts? I mean, When the Character dies the Gui’s Scripts won’t reset, right?

I put LocalScript in PlayerScripts when I don’t need to use Guis, but when I need to manipulate Guis I put them in PlayerGui. There is no difference AFAIK. I think it’s more your personal preference.

That depends on how the architecture should be. If you want a subsystem of only UI handling, you can port those into the StarterGui, presuming that the StarterGui contains pre-made GUI objects.

The StarterPlayerScripts is probably preferable if you are going to make one monolithic client system with several module scripts. You can reach the PlayerGui through Players.LocalPlayer, but have to remember to use the Instance:WaitForChild() at least once. This also solves the cross-communication between systems in clients, if you want extra control over this and that.

I think it depends on the game. I personally only use startergui to handle UI.