Best way to load in models from storage?

building
scripting

#1

I am currently working on a game that requires the loading in of a model set in 7 different positions.
I could copy the models in those exact positions and have the script call them in separately when needed… but I am planning for a very large amount of these models in the future. I am thinking there is probably a better way. Like maybe setting a primary part for each model and then calling the CFrame position within the script?


#2

I recently tried copy parenting fairly large models in to workspace from storage and noticed that parts of those models were missing on the client, even though they loaded on the server.

The way I got around it was loading sections of the models in incrementally, which is also easier performance wise on clients.

You may need to consider this when creating your system for loading on maps.


#3

Ya I can totally maybe understand needing to do that on a full map load in. I was actually considering using it for a smaller model load in.


#4

Anyway, you actually used the CFrame idea I was throwing out there?


#5

If you need collision detection on these models the only really practical way to do this is put them in ServerStorage and clone them out.

This is fast, but complex models will have to serialize to clients, which can take a little bit of time and may visually load in over many frames.

If you don’t need collision, a much faster high performance way is to put the models in replicatedstorage, and clone them locally on the client. The client will already have the data so the clone operation is very quick.

This is actually fast enough to make flipbook animations using part models, even on mobile.


#6

Ya, I have them in ServerStorage currently. Guess it would be helpful if I better explain what it is that I am doing. Okay so I have 7 different bases if will. At these bases each player will use a gui to access different models. The models being a reference for what they need to achieve. So rather than having to make the 7 different models in separate positions (In which could add up to hundreds or more) I was hoping for a way to make one model in replicated storage in which that could be loaded into different precise positions. Thinking that It may be easier. Now thinking maybe it won’t be easier LOL


#7

I’d just use some simple code and clone them out of server storage.

For your use case youd just need a defined pivot point for your model, which is what primarypart is for.

So if you had a marker for where your base model is meant to go, you’d just go something like

local number = 0
local newbase = game.ServerStorage:Find(“BaseName”…number):clone()
newbase.PrimaryPart.CFrame = CFrame.new(dest.Position)
newbase.Parent = workspace


#8

I love, love your answer :stuck_out_tongue: . Got to thinking about it though and I am probably gonna have to stick with this ServerStorage mass repetition thing Im doing currently. Just cause a lot more is going to play into it later on. I am also going to have it detect the current position of each part within the model in which then I will end up with like a mile long scripting thing going on. I mostly made this post just cause I haven’t ever posted (LOL… Don’t hate me) and I was kinda wondering :slight_smile: