Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Best Practices When Unloading Models?

I have a place where I have multiple models loaded in by the client, these models average at about 100 parts per model, I want to unload them to help those with lower end computers play without lag. Is it more efficient to simply use Model:Destroy() and then clone the model back in or is it better to parent the model to nil and load it and just parent it to workspace when I need it?

2 comments

2

It's probably more efficient just to set it's parent to ServerStorage and then parent it back to workspace.

0

Or set it's parent to nil and then parent it back.

1 answer

You can basically make a clone of the part and then parent it to somewhere (Ex: game.ServerStorage) and when you want it you can clone it to workspace here is an example script:

local P = Instance.new("Part")
P.Parent = workspace
local P2 = P:Clone()
P2.Parent = game.ServerStorage
P:Destroy()


wait(0.6)
local P3 = P2:Clone()
P3.Parent = workspace

3 comments

0

Do not put unloaded models in ReplicatedStorage. Objects in ReplicatedStorage still use memory. ServerStorage is a better idea as objects in there arent even seen let alone rendered by your computer.

0

Oops! My bad. Thanks for telling me.

0

@Gojinhan This is being done locally, each client will see different models loaded in depending on their position. So if ReplicatedStorage still uses memory then unloading the models with destroy would be the only way to free up memory, ergo being the best method?

This discussion is preserved as it was. New answers, comments, and votes are closed.