Make character walk on ceiling 2d sde scroller

I currently have it so if you press “n” then the gravity inverts and your character turns upside down and goes to the ceiling. The only problem is that when my character hits the ceiling he still acts as if hes floating and continues to run. I’m doing this in blueprint. Can anyone help me with this problem?