Scripting Help in Roblox Studio

Hello, so I made a building blocks script and I want to know how to get part size sides.

I mean like:

local mouse = game.Players.LocalPlayer:GetMouse()
local part = Instance.new("SurfaceSelection",workspace)

while wait(0.5) do
    part.Adornee = mouse.Target
    part.TargetSurface = mouse.TargetSurface
    script.Parent.Text = mouse.UnitRay.Direction.Magnitude
    mouse.Button1Down:Connect(function()
        local part2 = Instance.new("Part",workspace)
        part2.Anchored = true
        if mouse.TargetSurface == Enum.NormalId.Top then
            part2.CFrame = mouse.Target.CFrame + Vector3.new(0,mouse.Target.Size.Y,0)
        elseif mouse.TargetSurface == Enum.NormalId.Front then
            local neww = mouse.Target.CFrame.LookVector*
            part2.CFrame = mouse.Target.CFrame + neww
        end
    end)
end

So I want the part which will get created when clicked to be attached to the part.I clicked part A and it should spawn a part B attached to part A but how to know which side of size is.

Is part A size x = front for part a or part a size z for part a

Size = X,Y,Z

so how do i find which variable is which side there is no direction function for size