you will need to reduce the Position to the half of the size you increased
local Size = 5
local Part = workspace.Part
Part.Size += Vector3.new(0,Size,0)
Part.Position -= Vector3.new(0,Size/2,0)
or
local function changeSideSize(side, studs, part)
if side == "top" then
part.Size += Vector3.new(0, studs, 0)
part.Position += Vector3.new(0, studs/2, 0)
end
if side == "bottom" then
part.Size += Vector3.new(0, studs, 0)
part.Position -= Vector3.new(0, studs/2, 0)
end
if side == "left" then
part.Size += Vector3.new(studs, 0, 0)
part.Position -= Vector3.new(studs/2, 0, 0)
end
if side == "right" then
part.Size += Vector3.new(0, studs, 0)
part.Position += Vector3.new(studs/2, 0, 0)
end
if side == "front" then
part.Size += Vector3.new(0, 0, studs)
part.Position += Vector3.new(0, 0, studs/2)
end
if side == "back" then
part.Size += Vector3.new(0, 0, studs)
part.Position += Vector3.new(0, 0, studs/2)
end
end