How to send assets in Server Storage to the client

In a pet roleplay game, there are “morphs” which are custom character models you can become such as a dog or cat. In the morph menu, there is a text list of all the morphs. When you click on one, an information menu will pop up with the name, description, and a viewport for the model itself; the viewport is the important part.

If all these morphs are stored in Replicated Storage, it is easy for the client to locate the model, clone it, and insert it into the viewport frame. However, the morphs take up a lot of memory when stored together because of all the meshes, unions, textures, and animation data. The client will only need to have one morph at a time.

I wanted to store the assets in Server Storage instead. A solution I tried was to have the client send a remote function request for a specific morph model, which the server will return. One problem is that the client can’t see Server Storage so the model wasn’t passing through the remote function and was just showing as nil.

To fix the above problem, I modified the script to do this:

  • Client requests model
  • Server clones model and places it in Replicated Storage
  • The cloned model, which is in Replicated Storage now, is passed through the remote
  • The client clones the model and places it in the viewport frame
  • After 5 seconds, the model stored in Replicated Storage is destroyed

It worked, but… it’s not elegant and I’m sure it could cause some unknown problems.

What I’m asking for is if there is a better way to store assets in Server Storage and send a specific asset to the client if it asks for it. Also, if you think that I should just stop worrying and just place the morphs in Replicated Storage then let me know.

This isn’t a good idea, however, you could store them in ServerStorage, and then use the server to place them into the Local environment, using the same server script to listen for the RemoteEvent via something like OnClientEvent/OnClientInvoke and call that from a LocalScript, therefore removing the need for the use of ReplicatedStorage.

1 Like

That’s what I’ve already tried in the post, but I agree that it’s not a good idea. I think for now I’ll just use Replicated Storage and try to optimise memory as much as possible.

Maybe if there isn’t one already I could make a feature request for a way to only load assets from storage when the client requests it.