No particular reason, just bad coding. I also discovered if you add gravity to y velocity after setting y velocity to zero when on the floor the player will slide down a slope.