Problem in slicing parts effect

Hey, I’m making a part slicing thingy, but there is a problem. It’s not working as intended, here’s the code:

local Part = workspace.Union

local Player = game.Players.LocalPlayer;

local Mouse = Player:GetMouse();

Mouse.Button1Down:Connect(function()
	if Mouse.Target then
		if Mouse.Target == Part then
			local otherSize = Part.Size.Y - Mouse.Hit.Position.Y
			print(otherSize)
			local calCulatedSize = Vector3.new(Mouse.Target.Size.X, Mouse.Target.Size.Y - (Mouse.Hit.Position.Y), Mouse.Target.Size.Z)
			Mouse.Target.Size = calCulatedSize
			local newPart = Mouse.Target:Clone();
			newPart.Size = Vector3.new(newPart.Size.X, otherSize, newPart.Size.Z)
			newPart.Parent = workspace
		end
	end
end)

Also here is the video of how it should work:
https://gyazo.com/09fd2d89f41bf3317fb28fa8270b0d71

And what exactly is “going wrong”? It would be helpful if you could explain what isn’t working so we know what to help you fix. Any errors? Do you have screenshots/video of what’s going wrong?

You weren’t specifying the positions of each part:
Also, your othersize variable should be top of brick - click position
won’t work on unions because we can’t resize unions.

local Part = workspace.Part
local Player = game.Players.LocalPlayer;
local mouse = Player:GetMouse();

mouse.Button1Down:Connect(function()
	local target = mouse.Target
	if target then
		local newPart = target:Clone();
		local distanceFromTop = math.abs((target.Position.Y + (target.Size.Y/2)) - mouse.Hit.p.Y) -- how far away the player clicked from the top of the part
		
		target.Size = target.Size - Vector3.new(0,distanceFromTop,0) -- make the parts size it's current size without distanceFromTop
		target.CFrame = target.CFrame * CFrame.new(0, -distanceFromTop/2,0) --move target cf down to account for size change
		target.Anchored = true
		
		--create new 'top' part
		newPart.BrickColor = BrickColor.Random()
		newPart.Size = newPart.Size - Vector3.new(0,target.Size.Y,0) --make top part's size the original size without the bottom part's size
		newPart.CFrame = target.CFrame * CFrame.new(0, (newPart.Size.Y/2) + (target.Size.Y/2),0) --move the top part to be above the bottom part
		newPart.Parent = workspace --parent the part to workspace
		newPart.Anchored = false --unanchor the part
		newPart.Velocity = mouse.UnitRay.Direction * 20 -- move the top part forward as if it was falling
	end
end)