for _, button in pairs(SolidModelingButtonsArray) do
button.MouseButton1Click:Connect(function()
if debounce == true then
return
end
debounce = true
if button == UnionButton then
local otherParts = SolidModelingFunctionsModule.GetOtherParts()
if next(otherParts) == nil then
print("more parts need to be selected")
return
end
local success, newParts = pcall(function()
return GeometryService:UnionAsync(CommonlyUsedVariablesModule.mainPart, otherParts, {SplitApart = false})
end)
if success and newParts then
SolidModelingFunctionsModule.NewPartsFinishingTouches(newParts, otherParts)
end
elseif button == IntersectButton then
local otherParts = SolidModelingFunctionsModule.GetOtherParts()
if next(otherParts) == nil then
print("more parts need to be selected")
return
end
local success, newParts = pcall(function()
return GeometryService:IntersectAsync(CommonlyUsedVariablesModule.mainPart, otherParts, {SplitApart = true})
end)
if success and newParts then
SolidModelingFunctionsModule.NewPartsFinishingTouches(newParts, otherParts)
end
elseif button == SubtractButton then
local otherParts = SolidModelingFunctionsModule.GetOtherParts()
if next(otherParts) == nil then
print("more parts need to be selected")
return
end
local success, newParts = pcall(function()
return GeometryService:SubtractAsync(CommonlyUsedVariablesModule.mainPart, otherParts, {SplitApart = true})
end)
if success and newParts then
SolidModelingFunctionsModule.NewPartsFinishingTouches(newParts, otherParts)
end
elseif button == SeparateButton then
SolidModelingFunctionsModule.CleanUp()
local otherParts = SolidModelingFunctionsModule.GetOtherParts()
SolidModelingFunctionsModule.RejuvenateChildren(CommonlyUsedVariablesModule.mainPart)
for _, otherPart in pairs(otherParts) do
SolidModelingFunctionsModule.RejuvenateChildren(otherPart)
end
ButtonSelectionFunctionsModule.SelectDoublePreviousToolBarButton()
end
task.wait(0.1)
debounce = false
return
end)
end
Thanks!