Negative part turns to positive part when unioning with script

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to make a hole in a wall with a script.
  2. What is the issue? Include screenshots / videos if possible!
    Whenever I try to union negative parts and a normal part in roblox studio using a script, the negative parts turn positive. Here’s a clip:
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I looked on the dev forum, nothing.
I have tried to create the negative parts using a script, but when I did that it gave me error -25 when I tried to union them

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

-- Code I used for the script
-- // Variables
local negativeModel = workspace.Negatives
local negativeParts = {}
local mainPart = workspace.UnionPart
-- // Add parts to table
	for v, i in pairs(negativeModel:GetChildren()) do
			table.insert(negativeParts, #negativeParts + 1, i)
	-- // Script
	local union = mainPart:UnionAsync(negativeParts)
	union.Parent = workspace
	union.Name = "UnionedPart"
	union.Anchored = true
	for v, i in pairs(negativeModel:GetChildren()) do

If you know how to fix that, please reply.

When creating a union you have 1 main part, which you used correctly after that you are able to chose to negate (normal) parts/unions from it (they do not have to be negated first).

After making the decision if you wish to remove parts from the union or add you will
either use:


To union it together or to substract parts from it like so:


In your case you used :UnionAsync with negated parts, but instead you should just use :SubtractAsync with normal parts.

Read more here:

Instead of doing the following:

for v, i in pairs(negativeModel:GetChildren()) do
	table.insert(negativeParts, #negativeParts + 1, i)

You could just do:

local negativeParts = negativeModel:GetChildren()

As it gives the same result, an array with all the children of the “negativeModel”.

1 Like

I tried it and it worked. Thank you for your help!