Hi , I Wanted To add gravity and jumping mechanincs to my game and im kinda new to godot so i look some videos to give me an idea on how i could do it but my code doesnt work the gravity works properly but the jumping doesn't work this is my code

extends KinematicBody2D

var velocidad = Vector2(0,0)
export var speed = 300
export var velocity = 250
export var masa = 2
const gravedad = 10
export var salto = -100
const right = "ui_right"
const left = "ui_left"
const jump = "salto"

func _physics_process(delta):
	position.y -= delta * velocity * -2
	GetInput()
	animations()
	
	
func GetInput():
	
	velocidad = Vector2(0,0)
	if Input.is_action_pressed(right):
		velocidad.x += speed
	elif Input.is_action_pressed(left):
		velocidad.x -= speed
	if Input.is_action_just_pressed(jump) and is_on_floor():
		velocidad.y = salto
	velocidad = move_and_slide(velocidad, Vector2(0,-1))
		
	
func animations():
	if Input.is_action_pressed(right):
		$AnimatedSprite.play("Walking")
		$AnimatedSprite.flip_h = false
	elif Input.is_action_pressed(left):
		$AnimatedSprite.play("Walking")
		$AnimatedSprite.flip_h = true
	elif !Input.is_action_pressed(right) and !Input.is_action_pressed(left):
		$AnimatedSprite.play("Idle")

    First thing I would do is use print and just double check if is_on_floor() is working properly, that's the main culprit I'm thinking of looking at this code. I have a problem with some of Godot's built-in stuff and like the accuracy of raycasts more, sometimes the setup can be a bit fussy.

      Lethn haved tried that and checked Input too and both are working but even making the jump force be -10,000 doesn't even move.

      Try commenting out velocidad = Vector2(0,0)?

        Garlit velocidad = move_and_slide(velocidad, Vector2(0,-1))

        I'm not sure that assigning move_and_slide() to velocidad makes much sense. Just call move_and_slide() on it's own rather than trying to apply it to a variant.

        TL;DR: just remove the velocidad = part from that line.