I use FE and want server to invoke the client in order for the client to interact with a GUI, I prefer to put the LocalScript in ReplicatedStorage for neatness but it seems the client never gets invoked unless I put the LocalScript in StarterGui. Is this "okay" practice?
Is StarterGui an appropriate place to store LocalScripts?
1 answer
ReplicatedStorage does not run scripts. It's called -Storage for a reason.
There are really only five places where LocalScripts can run:
- A Player's Backpack, such as a child of a Tool
- A Player's Character model
- A Player's PlayerGui
- A Player's PlayerScripts
- The ReplicatedFirst service
It is obvious when you want to put a script in 1 and 5. But what about 2, 3, and 4? Here are some good rules of thumb:
For 2, put the LocalScript in the Character if a) You're manipulating the character itself and b) You expect the script to run again every time the player respawns.
For 3, put the LocalScript in PlayerGui if it manipulates the player's Gui.
For 4, put the LocalScript in PlayerScripts if you don't want it to reset whenever the player dies.
Because in your question, you're expecting the LocalScript to interact with the player's GUI, I would put it in the GUI.
tl;dr Yes, you can put it in StarterGui
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Thank you