VectorVelocity flings the character into the air when it hits a ledge

I’m trying to make this dash and I ran into a problem. Whenever the character dashes into a ledge, it is flung into the sky at very high speed.

I’m using VectorVelocity and this is how I did it:

local directionUnit = md.Magnitude > 0 and md.Unit or
    character.PrimaryPart.CFrame.LookVector

boost.VectorVelocity = directionUnit * 
    DodgeConfiguration.Distance.Value/DodgeConfiguration.Time.Value

local t = TweenService:Create(
	boost,
	TweenInfo.new(DodgeConfiguration.Time.Value, Enum.EasingStyle.Quad, Enum.EasingDirection.In),
	{VectorVelocity = Vector3.new()}
)

t:Play()

I don’t know how to stop this. I’m assuming I would have to put a vertical velocity limit but the character would still go up a bit. I also can’t use raycast to stop the player at the wall because there are slopes and the player won’t be able to dash on a slope.

Can anyone help me? It would be greatly appreciated.