The first attempt is me using a normal size, the second attempt is me using another size that wasn’t used before.
I don’t know how I would calculate this, whenever I change the size, it doesn’t act as the area that will be taken out of the part
local GeometryService = game:GetService("GeometryService")
local function createSlice()
local part = Instance.new("Part")
part.Transparency = 1
part.CanCollide = false
part.Anchored = true
part.Parent = workspace
return part
end
local function slice(newSlice,mainPart)
for _,comp in ipairs(newSlice) do
if comp then
comp.Anchored = false
comp.Parent = workspace
comp:SetNetworkOwnershipAuto()
end
end
end
--[[POSSIBLY USE RADIUS
--Vector3.new(radius,mainPart.Size.Y/2,radius) (original size value)
--]]
return function(mainPart,slicePart)
local sliceSize = Vector3.new(slicePart.Size.X,mainPart.Size.Y,slicePart.Size.Z)
local topSlice = createSlice() --//bring up
topSlice.Size = sliceSize
topSlice.CFrame = slicePart.CFrame * CFrame.new(0,topSlice.Size.Y/2,0)
local bottomSlice = createSlice() --//bring down
bottomSlice.Size = sliceSize
bottomSlice.CFrame = slicePart.CFrame * CFrame.new(0,-bottomSlice.Size.Y/2,0)
--//
local newTop = GeometryService:SubtractAsync(mainPart,{topSlice})
topSlice:Destroy()
local newBottom = GeometryService:SubtractAsync(mainPart,{bottomSlice})
bottomSlice:Destroy()
slice(newTop,mainPart)
slice(newBottom,mainPart)
mainPart:Destroy()
end