Hello I'm a new game dev trying to make a platformer with the typical dash mechanic my code has no errors but when playing, the dash just entirely does not work.
my code is below I'm sorry if I'm just missing something simple.

extends KinematicBody2D

const UP = Vector2(0, -1)
const GRAVITY = 22
const MAXFALLSPEED = 350
const MAXSPEED = 150
const JUMPFORCE = 420
const ACCEL = 100

#dashing var
var dashDirection = Vector2.ZERO
var canDash = false
var dashing = false
var velocity = Vector2()
var screen_size

var motion = Vector2()
var facing_right = true
var start_position = Vector2.ZERO
var facing


func _ready():
	start_position = position
	screen_size = get_viewport_rect().size
	
	
func _process(_delta):
	if position.y > 250:
		position = start_position
	$fps.text = str(Engine.get_frames_per_second())

func _physics_process(delta):
	
	dash()
	
	
	motion.y += GRAVITY
	if motion.y > MAXFALLSPEED:
		motion.y = MAXFALLSPEED
	
	if facing_right == true:
		$Sprite.scale.x = 1
	else:
		$Sprite.scale.x = -1
	
	motion.x = clamp(motion.x, -MAXSPEED, MAXSPEED)
	
	
	if Input.is_action_pressed("right"):
		motion.x += ACCEL
		facing_right = true
		$AnimationPlayer.play("Running")
	elif Input.is_action_pressed("left"):
		motion.x -= ACCEL
		facing_right = false
		$AnimationPlayer.play("Running")
	else:
		motion.x = lerp(motion.x,0,0.2)
		$AnimationPlayer.play("Idle")
	
	if is_on_floor():
		if Input.is_action_just_pressed("jump"):
			motion.y = -JUMPFORCE
	
	if !is_on_floor():
		if motion.y < 0:
			$AnimationPlayer.play("Jump")
		elif motion.y > 0:
			$AnimationPlayer.play("fall")
		
	motion = move_and_slide(motion, UP)


func respawn():
	position = start_position
	
	
func dash():
	if is_on_floor():
		canDash = true
		
	if Input.is_action_pressed("right"):
		dashDirection = Vector2(1,0)
	if Input.is_action_pressed("left"):
		dashDirection = Vector2(-1,0)
	
	
	
	if Input.is_action_just_pressed("dash") and canDash:
		velocity = dashDirection.normalized() * 100000
		canDash = false
		dashing = true
		yield(get_tree().create_timer(1), "timeout")
		dashing = false
		canDash = true

    WerdnaDev I think what's happening is your dash if statements are conflicting with each other because they are executing at the same time due to you calling the dash function, debug using print (canDash) you also don't need to use yield in Godot, there are timer nodes that are much less finnicky to get working and they have built in signals for what you're trying to do.

      Lethn thank you I will be trying this when I get home and will give you an update 👍

      Lethn hey i used print to debug and its printing what im asking it too but my character is still not dashing

        Megalomaniak i rewrote the code a bit and got the dash to semi work now no matter the value my player dashes very slightly extends KinematicBody2D

        const UP = Vector2(0, -1)
        const GRAVITY = 22
        const MAXFALLSPEED = 350
        const MAXSPEED = 150
        const JUMPFORCE = 450
        const ACCEL = 100
        export (float) var jump_buffer_time = 0.1
        export (float) var coyote_time = 0.1
        
        #dashing var
        var dashDirection = Vector2.ZERO
        var canDash = false
        var dashing = false
        var velocity = Vector2(1,0)
        var screen_size
        var jump_buffer_timer: float = 0
        const DASH_TIME = 5.0
        var dash_timer = 0.0
        
        var motion = Vector2()
        var facing_right = true
        var start_position = Vector2.ZERO
        var facing
        
        
        func enter() -> void:
        	jump_buffer_timer = 0
        	
        func input(_event: InputEvent) -> KinematicBody2D:
        	if Input.is_action_just_pressed("jump"):
        		jump_buffer_timer = jump_buffer_time
        	return null
        	
        func process(delta: float) -> KinematicBody2D:
        	jump_buffer_timer -= delta
        	return null
        
        
        func _ready():
        	start_position = position
        	screen_size = get_viewport_rect().size
        	
        	
        func _process(_delta):
        	dash()
        	if position.y > 250:
        		position = start_position
        	$fps.text = str(Engine.get_frames_per_second())
        
        func _physics_process(delta):
        	dash_timer = max(0, dash_timer - delta)
        	motion.y += GRAVITY
        	if motion.y > MAXFALLSPEED:
        		motion.y = MAXFALLSPEED
        	
        	if facing_right == true:
        		$Sprite.scale.x = 1
        	else:
        		$Sprite.scale.x = -1
        	
        	motion.x = clamp(motion.x, -MAXSPEED, MAXSPEED)
        	
        	
        	if Input.is_action_pressed("right"):
        		motion.x += ACCEL
        		facing_right = true
        		$AnimationPlayer.play("Running")
        	elif Input.is_action_pressed("left"):
        		motion.x -= ACCEL
        		facing_right = false
        		$AnimationPlayer.play("Running")
        	else:
        		motion.x = lerp(motion.x,0,0.2)
        		$AnimationPlayer.play("Idle")
        	
        	if is_on_floor():
        		if Input.is_action_just_pressed("jump"):
        			motion.y = -JUMPFORCE
        	
        	if !is_on_floor():
        		if motion.y < 0:
        			$AnimationPlayer.play("Jump")
        		elif motion.y > 0:
        			$AnimationPlayer.play("fall")
        		
        	motion = move_and_slide(motion, UP)
        	
        	if dashing:
        		velocity = move_and_slide(velocity, UP)
        		
        	
        
        
        func respawn():
        	position = start_position
        	
        	
        func dash():
        	if is_on_floor():
        		canDash = true
        		
        	if Input.is_action_pressed("right"):
        		dashDirection = Vector2(1,0)
        	if Input.is_action_pressed("left"):
        		dashDirection = Vector2(-1,0)
        	
        	if Input.is_action_just_pressed("dash") and canDash and dash_timer == 0:
        		velocity = dashDirection.normalized() * 5000
        		canDash = false
        		dashing = true
        		dash_timer = DASH_TIME
        		print("dash")
        		
        	if dashing:
        		motion = velocity
        		dashing = false
        		velocity = Vector2.ZERO
        
        func win():
        	print("win")

        WerdnaDev Please post what you did so that if anyone comes across this in the search they know what's going on, big pet peeve of mine lol.