How to create holes (windows) in a part (wall) via script?

I need to create walls with varying widths.
Depending on the wall width, I need to insert one or more windows.
That means I need to insert these windows via script and I can’t use a static MeshPart.
How to create holes (windows) in a part (wall) via script?


You could make one base wall with a window then just clone it till you get the length you want.

That’s a simple way, thanks.
However, I’d like to distribute the walls symmetrically.
For example, on a wall of length 10, I would have 2 windows with a distance of 5 between them.
If the wall is a little bigger, for example, 12, I would still have these two windows, but they would have a distance of 6 between them.
Now, if the wall has, for example, a length of 15, I would have 3 windows, with a space of 4 between them.
That would be the ideal solution.
So my question is if is it possible to make these “holes” in a part in a procedural way …

Maybe the answer is here: BasePart | Documentation - Roblox Creator Hub

Somebody already did this i’m pretty sure here it is.

I got it:

  1. Create a part “Wall” and another part “Window” which goes through the wall:

  1. Run this script (server):
-- note that the part(s) to be subtracted has to be inside a table
local Part = workspace.Wall:SubtractAsync({workspace.Window}) 
Part.Parent = workspace
  1. Running the script, here the result: