Jumping pads for 2d platformer

I’m making a 2d platformer and created jumping pads, so far they are working well, but as I defined that while you jump you can’t flip direction, I do want to be able to flip when jumping on the pads (only when I jump vertically).

I was able to find a way around by using raycast and the condition:

return true
else
return false```

It does work and I can flip. but now when I am trying to just jump above the pad, I am also able to flip.

what if you flip the player in the jump pad?