Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Is StarterGui an appropriate place to store LocalScripts?

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?

1 answer

✓ Accepted answer

ReplicatedStorage does not run scripts. It's called -Storage for a reason.

There are really only five places where LocalScripts can run:

  1. A Player's Backpack, such as a child of a Tool
  2. A Player's Character model
  3. A Player's PlayerGui
  4. A Player's PlayerScripts
  5. 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

1 comment

0

Thank you

This discussion is preserved as it was. New answers, comments, and votes are closed.