Await is_on_floor()

Godot Version

4.2.1

Question

I’m trying to create a condition which waits for the player to be on the floor after falling:

this is my code:

	if velocity.y < 0 and not is_on_floor():
		await is_on_floor()
		sprite.play("fall_land")
		playerstate = 4
		print(playerstate)

However this script prints 4 when the player is falling, not when the player has landed.

Please help

	if velocity.y < 0 and not is_on_floor():
               jumped = 1
if (jumped == 1 && is_on_floor()):
		sprite.play("fall_land")
		playerstate = 4
		print(playerstate)
               jumped = 0