Where should a local script be placed?

I’ve seen local scripts be placed in the starterPack, StarterPlayer, StarterCharacterScripts and StarterPlayerScripts. My question is what’s the difference in placing the local script in these 4 areas and if there’s any or where should the local script be placed depending on what I wanna do with it?

3 Likes

Localscripts behave similarly in both StarterPack and StarterPlayerScripts such that script.Parent.Parent is the relevant player instance. Placing localscripts in StarterPack is, however, no longer sensible since StarterPlayerScripts was designed for separate localscript storage from starter tools; placing a localscript in StarterPack would place it in the relevant player’s backpack instead of a designated folder named PlayerScripts within the player instance. Localscripts inside StarterCharacterScripts replicate directly into the relevant player’s character model. Localscripts within StarterPlayer won’t function since they aren’t intended to reside there; StarterPlayer is simply a container for a StarterCharacter, StarterCharacterScripts, and StarterPlayerScripts.

In summary, localscripts should never go in StarterPlayer and should rarely ever go in StarterPack. Developers typically place localscripts in StarterCharacterScripts when they deal with the relevant player’s character locally or when they should reinstate when respawning. Those independent of the state of the relevant player’s character should reside in either ReplicatedFirst or StarterPlayerScripts, varying with priority.

3 Likes

So StarterPlayerScripts is simply for storing starter tools?

https://developer.roblox.com/en-us/api-reference/class/LocalScript

2 Likes