Will it affect the performance of the game. ServerStorage or workspace

I have 40 thousand parts, I store them in the workspace in a specific folder and use them as needed in this way: if necessary

part .Parent = workspace

if not needed at the moment, I disable them

part .Parent = nil

The question is, is it better to store them in ServerStorage? Can this improve the performance of the game? Thank you.

It would be wise practice to store anything not necessary in ServerStorage until it is. Anything descendant of Workspace will be rendered with physics simulated, as well as being replicated to your players. It’d also help to not let players access things they aren’t meant to see unless they’re necessary; anything in ServerStorage is effectively ‘hidden’ from players. The ServerStorage and Workspace references explain well how these things are distinct.

3 Likes

Just in case, I’ll ask again :slight_smile:
That is, even if I use

part .Parent = nil

the game still spends performance on rendering them, even if they are not visible in the game?

If the parts are temporarily not needed in the game, do they need to be destroyed or Parent = nil? And then retrieve parts from the repository server again?

You’re right it’d no longer render if it’s not parented to workspace anymore. And the player wouldn’t have a performance hit if it’s not. Your only performance hit would be the script needing to iterate the folder and set everythings’ parent to nil when the server starts. Other than that, it’d just be much cleaner to house it in ServerStorage, and individually fetch what’s needed. Don’t call :Destroy() on something you may need in the future as that lets the garbage collector handle it and you’ll possibly lose it internally when you try to reference it again though.
*Depending on how you’re holding variables to reference these things after you set the parent to nil you may run into memory leakage

2 Likes

I load everything from the folder into the table, and then by the index I find the model I need

list[1].Parent = workspace

when no need

list[1].Parent = nil

will there be a performance difference if you keep it in server storage? Or is there no difference, just convenience?

From how you’ve handled it, I would say just convenience and coding style. If this works, I can’t see any performance issues beyond the script’s performance while loading the table/assigning parents, which should only be once when the server starts. Of course, you could test this by moving everything to serverstorage and trying it out yourself, code should not be too different to adapt to finding a child in storage vs finding an index in your table.

1 Like

If you move up the part/model far enough, it’ll stop being rendered, and anchoring it stops it from having physics.

1 Like

Depends what you wanna do, Workspace can be accessed by the Client, therefore, Exploiters can access it, ReplicatedStorage can be accessed by the Client, so again, Exploiters can access it. However, ServerStorage can only be accessed by the Server, often it is good practice to store anything in ServerStorage when the Client accessing it is not necessary.

Sorry thought you wanted an explanation on the difference, still keeping this here for people who want to know though.

1 Like

ServerStorage is not replicated in the client’s boundaries, therefore making ServerStorage better to store item(s) in. When it is needed, you should clone it and parent it to the global workspace (workspace). When it is un-needed, destroy it, or use Debris service! 40K parts are quite a bit and will affect your game dramatically.

Merry Christmas! :santa:

2 Likes