Looking to easily replace multiple parts with a single one

Hello,

I’m working on a maze game, and I’m currently making mazes using different segments put together:


Unfortunately, this leads to huge, unnecessary part counts, like this:

I’m wondering if there’s a way to easily replace multiple parts with a single one, without a lot of manual effort. I’m simply looking for a plugin, script, or anything that’d make this process less tedious and time-consuming (or an alternate way of creating mazes without a lot of tedious work).

1 Like

Feedback

In my opinion, you’ve been really efficient already. The only way I see you could make it potentially easier (if the maze is truly massive), is to either use meshes or group together reoccurring patterns such as corners and straights.

1 Like

I replicate squares with different patterns and put them together, but the problem is that it drastically increases the part count.

Would it work to replace the parts with a mesh like you mentioned? I’ve never really looked into part v. mesh performance.

1 Like

If it is performance you’re worrying about, don’t. Parts are instanced and are efficient because of it.

I’m afraid you’ll have to simplify your existing maze manually. With a maze generator you only have so many options and in return limited control over the final product, automating anything in this process will limit you in some way.


There are two things you can try to improve your workflow:

A quick-place Part generator (still tedious):


A prefabricated catalog of all the different segments you’ll be needing, the current way.

Your current palette isn’t too great, it will leave you with double walls, duplicated parts,… So I’ve cooked up a system that may help you and potentially others with this tedious process of maze building.

First you’ll need a well organized catalog:

This may not have every single segment you could be needing but these are the majority.

A summary of everything you need to know. first and foremost, everything besides the names are customizable because the script I’ll be posting below will require these exact names in order to function.
All models are on a 8 by 8 stud Grid containing the part(s) and a temporary part called “Placement” which functions as your navigational object (for rotating, moving and visual representation).

The green models are the models which contain the usable parts for your maze, and the red will be for visual representation as these will be deleted afterwards. The yellow hinges are also for visual representation, these will show you what parts of the model are “enterable”.

The way these are organized goes as follows:

We have two folders named “Geometry” & “Temporary” located directly inside Workspace, the green models go in Geometry and the red ones in Temporary.

P1

We have 2 kinds of green models called “Normal” and “W/ Ghost”, the “normal” models are models that have no special geometry, just regular models with parts that will be used regardless. The models called “W/ Ghost” are variants of the normal models with “Ghost” parts that will need to be removed eventually because they will align on the same axis with a part from a “normal” model.

A “Normal” model alongside the “Ghost” variant:

Why the two are different:

This “Ghost” model is connected to a model with two walls on both sides. You only want one part for each wall instead of dividing it unnecessarily, in this case the two blue “Ghost” parts will be removed at the end to make room for the parts of the connecting model.

This is how each of the 3 models are categorized:

For the two types of green models:

P2

For the red model:

P3

Everything named “Part” is just regular geometry that will make up your maze at the end.

With the current catalog of models shown above this is what a maze would look like arranged:

The red “Temporary” models make up anything inbetween any directional changes in your maze, they are just a visual representation of what your finished maze would look like.

After that copy & paste the code below in the command bar in Roblox Studio and hit enter.

local Workspace = game:GetService("Workspace")
local Geometry = Workspace:FindFirstChild("Geometry")
local Temporary = Workspace:FindFirstChild("Temporary")

local G_Dump = Geometry:GetChildren()
local T_Dump = Temporary:GetChildren()

if Geometry:IsA("Folder") then
	for _, object in pairs(G_Dump) do
		if object.Name == "Normal" then
			object.Placement:Destroy()
		end
		if object.Name == "W/ Ghost" then
			object.Placement:Destroy()
			object.Ghost:Destroy()
		end
	end
end

if Temporary:IsA("Folder") then
	for _, object in pairs(T_Dump) do
		if object.Name == "Model" then
			object:Destroy()
		end
	end
end

This is what your maze should look like:

(I did cheat a little because I wasn’t using the right models in some cases, but you get the idea.)

All that’s left to do is connect the parts. Set the Grid size for the resize tool to the Grid size you chose for the models and everything should align properly.

This is what the outlined now maze looks like:

From here you can start adding details like props, textures,…

I hope this will save you some time.

NOTE: Everything besides names are customizable with this format, if you do want to name things differently make sure to change their names with the corresponding names in the code as well.

Good luck.

2 Likes

Thank you so much! This will definitely help out, and it’ll greatly improve the workflow of me and my fellow teammates.