How can I stop this?

When I click on the part I’m slicing it in half turning it into a union, but it just stays like this and doesn’t fall off? They seem to be attached to each other, if this is a result of simply being a union then how do I separate them? Video:

yes if its a union it would stay attached, the only way to unattach them is by making them 2 seperate parts

(a union is just a part that has chunks taken out of it, it still has its original hitbox and stuff like that)

But how do I do this via a script?

you would delete the original part and create 2 parts that are the same material and color but are half the size of the original one.
the first part’s position would be oldp.Position + (oldp.Size / 2)
the second part’s position would be oldp.Position - (oldp.Size / 2)
oldp being the old part in this case

edit: you might want to make it a bit smaller than half of the old part since you want it to look like its getting cut in half and you also would probably want both of them to be unanchored

This would work in this case, but eventually I’m planning to make it sliceable with your mouse, and that wouldn’t be possible without a union

Add a ClickDetector in the part with a Script:

script.Parent.MouseClick:Once()
    local clone = script.Parent.Parent:Clone()
    clone:ClearAllChildren()
    clone.Anchored = false
    clone.Size = Vector3.new(clone.Size.X, clone.Size.Y / 2, clone.Size.Z)
    clone:PivotTo(script.Parent.Parent:GetPivot() * CFrame.new(0, clone.Size.Y, 0))
    local clone2 = clone:Clone()
    script:Clone().Parent = clone
    script:Clone().Parent = clone2
    clone2:PivotTo(clone:GetPivot() * CFrame.new(0, -clone.Size.Y, 0))
    clone.Parent = workspace
    clone2.Parent = workspace
    script:Destroy()
end)

Pretty messy for my standards but on paper it should work.

1 Like

Maybe this tutorial helps?