CSG 'Error Code -25'

I am getting the following error message:

Something went wrong. CSG returned error code -25. Please file a bug report, preferably with a file containing the problematic object(s)

With the following parts:
buggy.rbxm (184.9 KB)

And the following script:

local u = game.Workspace.Union

local p = Instance.new("Part")
p.Size = Vector3.new(1,1,1)
p.Anchored = true
p.CanCollide = false
local pos = u.Position

function randomSphericalPoint(c,r)
	local t = math.pi * math.random()*2
	local p = math.acos(2*math.random() - 1)
	
	return Vector3.new(
			math.sin(t)*math.cos(p),
			math.sin(t)*math.sin(p),
			math.cos(t)
		)*r + c
end


function raycastToPart(p,pt)
	local r = Ray.new(pt,(p.Position - pt)*5)
	return workspace:FindPartOnRayWithWhitelist(r,{p})
end
for i = 1,1,1 do
	pt = nil
	while(not pt) do
		_,pt = raycastToPart(u,randomSphericalPoint(u.Position,20))
	end
	
	local c = p:Clone()
	c.Size = Vector3.new(1,1,1)*math.random()
	c.CFrame = CFrame.new(pt)
				--*CFrame.Angles(math.pi*math.random(),0,0)
				--*CFrame.Angles(0,math.pi*math.random(),0)
				--*CFrame.Angles(0,0,math.pi*math.random())
	c.Parent = game.Workspace
	u:SubtractAsync({c})
	c:Destroy()
end

Basically all I’m trying to do is add randomly generated ‘dimples’ to the union object.

1 Like

A post was merged into an existing topic: CSG Failures