How to fix lag with parts?

So I have around 1k+ parts in workspace at one time. This can cause lag for lower end computers, and I was wondering how I would fix that lag. It is lagging a bit for me right now, and its pretty annoying. I have heard of rendering the parts, but how would I do that?

2 Likes

1k parts is not a large amount of parts. Not sure why this is in the scripting category but go check the microprofiler and see what the real culprit is.

Well more than 1k. I have around 1000 parts to start and 10 parts generated every 1 second and they despawn in 20 seconds.

Use unions for part that are like the same color.

Please provide more detail on what exactly you are spawning the parts for.

It is basically things that players pick up similar to simulator.

I would consider making these parts local, so they are not as taxing on the server.

I completely disagree, from experience I can testify that adding unions can create immense portions of lag for the client and server. Due to this, when building large projects, I completely leave unions out of my builds. Because this is under a post discussing lag, I would argue that your statement was completely false.

1 Like

From experience? Not from also testing or checking posts related to union improvements or performance issues involving parts?

Unions do not cause performance issues, no BasePart does. The only time BaseParts cause lag is when they are placed down en masse and this is primarily due to their involvement with both the physics and rendering engine, not because they exist at all.

Several optimisation efforts also exist for unions in-engine and there are also many code-based strategies you can implement yourself to further reduce part rendering intensity, such as loading in chunks. The server isn’t going to lag from a few ten thousand parts, it doesn’t have to render anything.

I disagree with your disagreement wholeheartedly.


@OP

Either you haven’t included enough details in this post or I skimmed a question that asked for details to which you replied with. 1k parts is nothing. If you explained the real situation, please also drop that in the original post so we know what the issue is.

2 Likes

I know this may not seem relevant but I have noticed in all of my testing games etc. That if you have a print that is repeated to much on the server it will cause you to think the parts are making you lag but it is just the print command. Check your console when you get the lag and see if anything is printing like this server or even client side can cause this.

1 Like

that would only cause lag in studio

It will do it in server also when the owner/creator is playing. It maybe fixed now but used to be an issue I had when running test on games.

It is near impossible to lag a player with 1k parts even if they have a “low-end computer”.

I see some people debating about unions. Just for future reference, unions cause heavy server load but not anything with rendering and such. Unions are harmless if used right. There are a bunch of loading systems that can resolve things like this.

Secondly, I ought to bring up that we need more context to this. I don’t think you are lagging people due to part count, it is probably how your script approaches the instances of these entities/objects. Can’t say anything for sure but you should definitely give us more information to this.

It mostly depends on the density of parts in space. If you have a few thousand parts and they’re not very close to each other then you’ll be fine. If they’re all very close to each other and moving it starts to get slow because they need to be tested to see if they collide with each other. Roblox likely does this via partitioning space using an octree, but when parts are very densely packed you end up still having to check for collisions between all those pairs of parts (roughly speaking).