Should client modules be in ReplicatedStorage or PlayerScripts?

Hi, I’ve watched many tutorials on organizing games with modules and nearly all of them suggest placing them in PlayerScripts(StarterPlayerScripts). I don’t understand why though, because doesn’t it make more sense to put them in ReplicatedStorage so that these modules aren’t replicated many times in PlayerScripts?

3 Likes

Yeah, I always put them in ReplicatedStorage and I think that’s the best practice.

ReplicatedStorage is shared between the client and server. Nothing is stopping you from placing your client modules there. Although its pretty unnecessary and unclean way of managing your project. You should use it as its functionality implies. Keeping anything there that you need to use between the server and client.

Your question about PlayerScripts could be answered here StarterPlayerScripts | Documentation - Roblox Creator Hub

How it works if you store the modules in StarterPlayer.StarterPlayerScripts:
The server will replicate the modules in StarterPlayer.StarterPlayerScripts once to each player in their Player.PlayerScripts folder when they join the game.

How it works if you store the modules in ReplicatedStorage:
The server will replicate the modules in ReplicatedStorage once to each player in their ReplicatedStorage when they join the game.

As you can see, the only difference is that when you store the modules in ReplicatedStorage, the modules will also get replicated to ReplicatedStorage whereas if you store the modules in StarterPlayer.StarterPlayerScripts, the modules gets replicated to each individual player’s PlayerScripts folder.

If you put them in ReplicatedStorage, you don’t have to type as much to require them (eg require(ReplicatedStorage.ClientModule) as opposed to require(StarterPlayer.StarterPlayerScripts.ClientModule)

If you put them in StarterPlayer.StarterPlayerScripts, you get slightly better organization because your client modules are in a different place than your shared modules.

But ulimately there’s little difference between the two, and you’ll always see people do it the other way, so don’t worry about it and do it the way you like!

1 Like

I like to place them inside replicatedstorage, it depends on how you organize your game, both replicatedstorage and playerscripts will work…

The server doesnt replicate the playerscripts to each player like the startergui/playergui does

It does


“A container for objects to be copied to a Player’s PlayerScripts when they join a game”

1 Like

what i mean is that the server cant see playerscripts like screenguis/playerguis…

you cant access them from the server
image

1 Like

You’re correct, but they can see StarterPlayer.StarterPlayerScripts, which they will replicate to the client, and the client will parent it to their PlayerScripts Folder

2 Likes

Client modules will always be placed in replicated storage

Server modules will be in server storage

1 Like