Is there a way to make 1-2million parts run optimized?

I have a game with about 1 to 2 million parts crammed in a rectangular shape. When i try to union them studio stops responding. Is there another way to optimize 1 to 2 million small parts? (I know its feels unrealistic but it is real)

1 Like

You can convert large chunks or the entire model into a mesh, utilize a batch processing system to automatically break down the parts into chunks, enable StreamingEnabled, etc. You won’t be able to union so many parts as it will overload Studio and cause it to crash.

There may be alternative methods, so wait to see if anyone replies.

3 Likes

My problem is that I need to change the position and color of each part individually

If you’re going for a randomization method, use a for loop.

for part in ipairs(workspace:GetDescendants()) do
	if part:IsA("BasePart") then
		local randomPosition = Vector3.new(
			math.random(0, 100),
			math.random(0, 100),
			math.random(0, 100)
		)
		part.CFrame = CFrame.new(randomPosition)
		part.Color = Color3.fromRGB(math.random(0,255), math.random(0,255), math.random(0,255))
	end
end

Change this as you please and please provide more specific details about what you are seeking.

1 Like

I was trying to say that if i made the parts a mesh i can not make it change color or position they will just move with eachother

I understand. My best suggestion would be to apply your desired changes to each part and utilize StreamingEnabled.

StreamingEnabled

1 Like

You can select all, color them, right click while selecting all of them, and ‘Export as OBJ’. Then, you should use some optimizer tool.

2 Likes

if you are trying to do 1-2 Milion parts in game good luck. From my knowledge it is Incredibly dificult to make 10% of that run well on roblox. wether or not they are all anchored and cant be collided with may really help. but having that many parts is not what roblox is built for and likely will not run well. It really depends on if you can somhow make them not exist and only have them where you need them. although having the context of what your doing would really help in this case

The short answer: no
Roblox starts losing it when getting close to 6 digit part numbers. Especially if those parts are all crammed in a small space.
Try using a mesh, though you’re going to find a way to cut it down from ~10 million triangles to 10,000 (the limit for roblox)