SubtrctAsync not working

I want this script to work, and print(“Works”).
There are No errors, and. this is on a server script
My script is larger than this, but i pinpointed it to here.

	print(part,part.Parent)--this works
local TouchedPart = part --this works
		local DrillUnion = {script.Parent.Union}--this works
		local Newunion = TouchedPart:SubtractAsync(DrillUnion)--this doesn't work.
print("Works")

Am I missing something important?

1 Like

I’m pretty sure this only works in studio and is used for plugins. I’m not 100% sure though.

I got it working earlier with some other parts though.

Anyone have any ideas? I don’t know what to do.

SubtractAsync creates a new union with a parent set to nil iirc, so right after you use SubtractAsync you should do:

Newunion.Parent = game.Workspace

Also, by using the method, the original parts are not deleted, so it’s possible the the parts are simply just covering up the union and you just have to delete the original parts after calling SubractAsync

The above post is the solution, mark it as such.

Farther down the script, I do delete the parts, and parent the union to workspace.

Is the part you are using to subtract a NegativePart or just a normal BasePart?

I am subtracting a union from a part.

Try a NegativePart. I don’t know if that makes a difference, but you should try it.

Nope, doesn’t work, good idea though.

Anyone else have more ideas? I think this one might be unsolvable.

I eventually got it to work. Here is the link for the finished model. Drill - Roblox

Can you elaborate further? What did you exactly do to fix the issue?

Honestly, I think my fixed code was close to the same original script. Sometimes it seems that Roblox’s services don’t load something, then I rearange the code and it works perfectly, even thought it is the same exact thing.

print(part,part.Parent)--this works
local TouchedPart = part --this works
		local DrillUnion = {script.Parent.Union}--this works
		local Newunion = TouchedPart:SubtractAsync(DrillUnion)--this doesn't work.
print("Works")

turned into

print(part,part.Parent)--this works
local TouchedPart = part --this works
		local DrillUnion = {script.Parent.Union}--this works
		local Newunion = TouchedPart:SubtractAsync(DrillUnion)--this DOES work.
print("Works")

Even though I changed hardly anything.

Yeah, CSG 3 is the glitchiest system Roblox has. It crashes all the time.

I’ve never experienced the issues, but it happens. For me it’s very stable.

1 Like