How to clone a part hosted in ServerStorage only for the current player?

This is my scenario:
My game will have hundreds of meshes/parts, which means it will take up a lot of space, as each mesh can occupy several Kb or even Mb, depending on the complexity and texture of each mesh.
This way, to avoid unnecessary data transfer, the user will choose manually a part via GUI (like Minecraft) and only then the part will be loaded.

For that, I’m hosting ALL parts on ServerStorage.
When the user chooses which part he wants via GUI, I start a RemoteFunction, like

ReplicatedStorage:WaitForChild("MyRemoteFunction"):InvokeServer(partName)

And inside ServerScriptServer I have a script with this function which finds this part (all parts are in a folder “MyFolder”) on the ServerStorage and clone it to workspace:

local part = game.ServerStorage.MyFolder:FindFirstChild(partName)
local partWorkspace = part:Clone()
partWorkspace.Parent = workspace.MyFolder
return partWorkspace

So far so good…
The problem here is: when I clone a part to workspace, that part will be cloned to ALL players. I don’t want it, once it’s unnecessary because, in my game, there are rooms where only the current player can see his items, therefore there is no need this part to be replicated to all players.

But it seems not to be possible to clone a part via ServerScript only for the current player. Am I right?

At the same time, if I put all these meshes/parts in ReplicatedStorage, this will be the worst scenario, because the game will transfer ALL the bytes of all parts to all players, causing a communication overhead.

In short, is there a way to clone a part located inside ServerStorage ONLY for the current player?

I think there’s a better solution to your problem. Are the items like just preset items? (I.e. Sword, gun. etc)
If so, then why not have an entire folder of those items on the client ready for them to clone and position based on what the server demands?

This way everything is automatically loaded and all you have to do is send the positions/places/amount to the client and it will automatically place it there.


I know in your post you try avoiding this but it’s really not the worst thing you can do. If an asset doesn’t load in Replicated Storage you can always yield for it until there’s a better time. Putting in in Replicated Storage allows the client to load what it sees best in whatever order. I’m not entirely sure how the specifics are with the loading on the client but I’d imagine it handles whatever it gets streamed first then ReplicatedStorage is a lesser priority than say workspace.


Otherwise no there is no good way. You could send all of the part’s data and send it to the client for it to create the part on the client, but that may not be ideal.

1 Like

There’s no way for a player to get a server created object unless it’s replicated to the client or created by the client with some data passed around.

What you could do is use a RemoteEvent. You’d have to create the instance on the server, then parent it to the ReplicatedStorage (so the client can access it). Call FireClient(playername, object) and have the client listening for the event. The client could then clone the instance locally.

After the event is processed on the specific client, have the client call FireServer() on the RemoteEvent. Then the server could delete the part from the replicated storage. Thus, having the specified player the only player remaining with an instance of the object.

1 Like

So let me see if I understand. I have, for example, 100 parts in ServerStorage. To get only one of them, chosen by the user, the workflow might be:

  1. The user chooses a part via GUI (LocalScript), for example, “Part25”
  2. Still in LocalScript, I call a RemoteFunction which is stored in a script inside ServerScriptService, passing “Part25” (.Name, string) as the argument
  3. Within the ServerScript, the RemoteFuncion will find the “Part25” inside the list of parts in ServerStorage (using FindFirstChild())
  4. Found “Part25” on ServerStorage, the RemoteFuncion will .Parent this part to ReplicatedStorage and return this part to LocalScript (this will in fact transfer all the bytes of “Part25” to all players, but it will not be available for them)
  5. The original function called in LocalScript receives the part reference (via return) and then :Clone() it to workspace.
  6. Once this clone was made via LocalScript, “Part25” will be only visible/available for the current player.

Is that correct?

1 Like

That is correct, only the player under which the LocalScript set the part’s parent to workspace will be able to see that part.

1 Like