Union Negative Parts

I am trying to create a simple hole in a wall. My script currently creates a negate operation, then unions it with the wall using UnionAsync. The problem comes when I try to union it, it says “Something went wrong. CSG returned error code -25”. Is there a different method I should be using to union parts? Thanks in advance for your help.

You should be able to just use SubtractAsync with normal parts

Have you tried creating the Part and Negated Part manually to see if they work in Studio, but not in the script?
I’ve had Unions in the past that have given errors, but moving one part .001 stud fixed the issue.

When I try that it doesn’t give me any errors, however it doesn’t subtract or union the parts either. Is there something I am doing wrong? I know that both the wall and the hole are correctly defined.

local Hole = {negPart}

Wall:SubtractAsync(Hole)

I make holes in parts without a script. Why would you need a script to make a hole in a part?

Theyre both normal parts right? No negative parts?

I want to be able to do it multiple times and in positions that are generated when you play the game.

Yes. I also tried UnionAsync() with a negative part, but the same thing happened.

OkAy, I understand why u are using a script.

Are you using BasePart | Roblox Creator Documentation in a Server or Local script? Try the link to see if the list of errors are anything you are doing.

I’m running it from the server. None of the errors listed apply. Here is what my explorer looks like:

> Base (Part)
   > Script
> Hole (Part)

The script:

wait(3)

local Base = script.Parent
local Hole = {game.Workspace.Hole}
Base:SubtractAsync(Hole)

I also tried using UnionAsync() with a negative part as the hole, but both of these just don’t union them, no errors. I don’t know why the other one gives me the error and this doesn’t.

The script in the BasePart | Roblox Creator Documentation page is like this:

local yellowPart = workspace.YellowPart
local pinkParts = {workspace.PinkPart, workspace.PinkPart2}
local union = yellowPart:SubtractAsync(pinkParts)
union.Parent = workspace

So they define the union, unlike your script where you just had:
Base:SubtractAsync(Hole)

And then they make the Parent of the new union workspace.

Ahah, thank you. I thought I had tried that but I guess not. It works perfectly in all my scenarios now.

1 Like