SubtractAsync creating invisible unions

(Accidently over wrote this)

Some reason when using Subtract Async it creates invisible unions/parts?

local function GetTouchingParts(part) -- gets touching parts, even not can collide
	local connection = part.Touched:Connect(function() end)
	local results = part:GetTouchingParts()
	connection:Disconnect()
	return results
end


local function CutPart(Pos, Orientation)
	local Invis = game.Workspace.Ignore.Invisible -- move the invisible part in place
	Invis.Position = Pos
	Invis.Orientation = Orientation

	local Touching = GetTouchingParts(game.Workspace.Ignore.Invisible) -- get touching
	for i,v in pairs(Touching) do
		if v.Parent.Name == "Cutable" then -- can be cut (In a folder called "Cutable")

			local Cut1 = Instance.new("Part") -- create first part for Subtract
			Cut1.Anchored = true
			Cut1.CanCollide = false
			Cut1.Transparency = .7
			Cut1.Color = Color3.fromRGB(255,0,0)
			Cut1.Size = Vector3.new(v.Size.X*2, v.Size.Y*2, v.Size.Z*2) -- make it bigger just incase
			Cut1.CFrame = (Invis.CFrame + Invis.CFrame.UpVector*(Cut1.Size/2)) -- move it above the Invisible Part
			Cut1.Parent = game.Workspace.Ignore
			
			local Cut2 = Cut1:Clone() -- create second part for Subtract
			Cut2.Color = Color3.fromRGB(0,255,0)
			Cut2.CFrame = (Invis.CFrame + Invis.CFrame.UpVector*-(Cut2.Size/2)) -- move it below the Invisible Part
			Cut2.Parent = game.Workspace.Ignore

			local union1 = v:SubtractAsync({Cut1}) -- subtract first part
			union1.Anchored = false
			union1.Parent = v.Parent
			union1.Name = "union1"
			
			local union2 = v:SubtractAsync({Cut2}) -- subtract second part
			union2.Anchored = false
			union2.Parent = v.Parent
			union2.Transparency = 0
			union2.Name = "union2"

			v:Destroy() -- delete original
			game:GetService("Debris"):AddItem(Cut1, 1)
			game:GetService("Debris"):AddItem(Cut2, 1)

		end
	end
end

Add to call it using the code:

CutPart(Vector3.new( -11.0081692, 9.77158928, -73.8000031), Vector3.new(0,0,45))

Is there any possibility i am corrupting the unions on creation?

Unions can sometimes have complications on creation. You would need to have a checker for this so you can then redo the union.

This can happen with complex or big unions.

What would the best way to detect if they are invisible do you think? as the “Transparency” parameter is still set to 0

well im not too sure. All the properties would be the same.
I guess you can pcall it and check when it errors.

Weird thing is that it doesn’t actually error, even if its invisible

Maybe i have to change something in the argument “renderFidelity” will carry on looking

Adding “Default” and “Precise” to the subtract async appeared to fix it, tested with the code below:

for i=0, 360, 1 do
	print("DOING ORIENTATION >> " .. tostring(i))
	CutPart(Vector3.new( -11.0081692, 9.77158928, -73.8000031), Vector3.new(0,0,i))
	wait(2)
	if game.Workspace.Cutable:FindFirstChild("union1")then
		game.Workspace.Cutable:FindFirstChild("union1"):Destroy()
	end
	if game.Workspace.Cutable:FindFirstChild("union2")then
		game.Workspace.Cutable:FindFirstChild("union2"):Destroy()
	end

	local Part = Instance.new("Part")
	Part.Anchored = true
	Part.CanCollide = true
	Part.Size = Vector3.new(10, 10, 10)
	Part.Position = Vector3.new(-11.008, 9.772, -73.8)
	Part.Parent = game.Workspace.Cutable
end

New Subtract:

local union1 = v:SubtractAsync({Cut1}, "Default", "Precise")
1 Like

is the default and precise for the render fidelity?