Having a lot of trouble implementing slopes in 2D Platformer.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Kekd

I’m making a 2D platformer. I move the player, a KinematicBody2D, using move_and_slide_with_snap(). The player accelerates, instead of instantly moving at max speed, done using linear interpolation:

(velocity.x = lerp(velocity.x, dir * speed, acceleration)

Currently, when the player stands on a slope, they slide down, and when falling onto a slope they get a lot of horizontal speed, which is not what I want.
I have tried everything I can think of. stop_on_slope is set to true, I have tried setting the snap to some ridiculous amount, I have tried setting the max_floor_angle to different values, I have spent hours browsing the internet and looking at demos, but I found nothing.
The only answers I’ve found didn’t really work for me, because they only work in situations where the movement doesn’t have any acceleration, like in the Platformer2D demo (2D Platformer Demo (KinematicBody) - Godot Asset Library)
So my question is: Is there a way to solve this problem?