You could try with:
elif Input.is_action_pressed("jump") and is_on_floor():
motion.y = -800
Also, note that you should update the motion using
move_and_slide so the gravity doesnt add while on floor, like this:
motion = move_and_slide(motion, Vector2.UP)
I also added the second parameter as i assume you are making a side scroller from your controlls. The function needs that parameter to know where is the floor.