Hello. I am making a window creator, but whenever I run my code, it returns the following:
'Something went wrong. CSG returned error code -25. Please file a bug report, preferably with a file containing the problematic object(s)’
Here is the module script I wrote:
local module = {}
function module:NegatePart(part)
assert(part, "Argument 'Part' missing or nil")
local negateOperation = Instance.new("NegateOperation", workspace);
negateOperation.Size = part.Size
negateOperation.CFrame = part.CFrame
negateOperation.BrickColor = part.BrickColor
negateOperation.Transparency = part.Transparency
return negateOperation
end;
function module:CreateWallWindow(objects, wall)
assert(objects, "Argument 'Objects' or nil")
assert(wall, "Argument 'Wall' missing or nil")
local newWall = wall:SubtractAsync(objects)
newWall.Parent = newWall.Parent
newWall.CFrame = newWall.CFrame
newWall.Name = newWall.Name
for _, v in ipairs(objects) do
v:Destroy()
end
end;
return module
Here is the server script that runs:
local window = (script.Parent);
local module = require(script:WaitForChild("Module"));
local negatedPart = module:NegatePart(window);
module:CreateWallWindow({negatedPart}, workspace.Wall)
Here is the file for those who want to test it for themselves: Issue.rbxl (23.6 KB)
local module = {}
function module:NegatePart(part)
--Don't need this you're using SubtractAsync
end;
function module:CreateWallWindow(objects, wall)
assert(objects, "Argument 'Objects' or nil")
assert(wall, "Argument 'Wall' missing or nil")
local newWall = wall:SubtractAsync(objects)
newWall.Parent = wall.Parent --not newWall parent
newWall.CFrame = newWall.CFrame
newWall.Name = newWall.Name
for _, v in ipairs(objects) do
v:Destroy()
end
wall:Destroy() --get rid of old wall since its updated
end;
local window = (script.Parent);
local module = require(script:WaitForChild("Module"));
module:CreateWallWindow({window}, workspace.Wall)
main issue was creating the negateoperation. even if u set the size it was acting as if it was nonexistent.
could u be more specific? like the type of errors being displayed/screenshot of what ur doing?
cause the script does work when i test it using the rbxl file u provided.