ServerStorage and RepletedStorage have their advantages and disadvantages.
ServerStorage: - I would put the maps here.
The wiki says: “By storing large objects such as maps in ServerStorage until they are needed, network traffic will not be used up transmitting these objects to the client when they join the game.” This means the map is stored their until needed and isn’t ‘loaded in’ when the client joins the game.
ReplicatedStorage
ReplicatedStorage Replicates the objects onto the client when they join the game so it may take longer for the clients to load it. Replicated storage is an ideal place for remote events and module scripts. Here is the quote from the wiki page:
“ReplicatedStorage is a container whose contents are replicated to all connected clients, allowing such objects to be stored until needed. ReplicatedStorage is also an ideal location for RemoteFunction|RemoteFunctions and RemoteEvent|RemoteEvents since they can be found on both the client and server.”
Cloning
I would clone the maps as if one map gets messed up like something has been deleted when it is in use, it doesn’t matted as such because their will be a fresh copy of the map in ServerStorage or ReplicatedStorage.
As an additional security step, I would have some method of communicating to the clients that the map has been loaded in. If you’re executing things on the client then it’s recommended you wait until the server notifies the client to run those scripts.
By far the best method (that I have never run into problems with) is to load the map in piece-by-piece with a for loop. This is faster than just cloning the map into Workspace and doesn’t create a giant lag spike when the map loads.
In addition to this, to prevent players from falling through the map, I locally set each player’s gravity to 0 before teleporting them. I then set it back to normal once the map has loaded for them.
As with intended_pun’s reply I would have all maps in the ServerStorage to reduce memory, processor and network usage. Unless you need all the maps loaded in at start, having them in ServerStorage is definitely the best alternative.
Load the map in piece by piece so the clients won’t get met with a huge lag spike.
网友评论