How to walk on the roof?

I’m making a 2D plataform game, my character can change his gravity, but at the moment he “step” on the roof, he is just “keeping falling” …stuck in the “is falling” state, and it cant walk on it… …its there a way to override the is falling method… or maby some way to tell the game that the walkable floor is now the roof?