you will have to write your own z_top() function that matches your instance position. Likely the issue is that you are overlapping the slope when checking its height and it is too tall at that point to walk up it.