Is there a way to detect if a player is going up/down a hill/wedge?

Im working on a sliding script and right now the script will keep sliding on a wedge part until it reaches a flat surface even if they are moving up. So I was wondering if there was a way to check if the player is going down the hill instead of up, other than comparing the positions overtime.

Here is my current script:

use raycast normal. then convert it into an angle