– Function to create a hole in a part
local function createHole(piece, position)
local sphere = Instance.new(“Part”)
sphere.Shape = Enum.PartType.Ball
sphere.Size = Vector3.new(1, 1, 1)
sphere.CFrame = position
sphere.Color = piece.Color
sphere.Transparency = 1
sphere.CanCollide = false
piece.Anchored = false
sphere.Anchored = true
local Parts = {sphere}
sphere.Parent = game.Workspace
local success, newUnion = pcall(function()
return piece:SubtractAsync(Parts)
end)
if success and newUnion then
print("Work")
newUnion.Position = piece.Position
newUnion.Parent = piece.Parent
piece:Destroy()
newUnion.Anchored = true
return newUnion
end
end
– Function to destroy a part and create a hole in its place