If u need then just take it no need credit (u can if u want though :D) Explanation: This finds the slope by using raycasting. it raycasts 2 rays with a slight offset away from the direction of the player. It then finds the direction from the end of 1 raycast to the other.
Thanks to @awesome-llama-test form the point towards block.