I have trouble's with invalid get index error. Are there somebody who can help me with that error?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By BlinMaker2077

I’am beginer and i started to learning the basics from one czech godot tutorial. I was folowing the tutorial and meanwhile the shoot coding i’ve get the error. It showing the error : Invalid get index ‘speed’ (on base: ‘Node2D’).
i’ve checked if i write the code incorectly but i didn’t found something.
I don’t have any idea how to fix this. So is there somebody who can help me?
I will show the all the codes bellow this text.

extends KinematicBody2D

export var speed = 300
export var gravity = 2000
export var jump = -1000

var move = Vector2()
var directory = 1

var scenastr = preload("res://shooting.tscn")

func _physics_process(delta):
	if Input.is_action_pressed("end"):
	pohyb.y += delta*gravity
	if is_on_floor():
		if Input.is_action_pressed("right"):
			pohyb.x = -speed
			directory = -1
			$animatedGuy.flip_h = true 
		elif Input.is_action_pressed("right "):
			pohyb.x = speed
			directory = 1
			$animatedGuy.flip_h = false
			pohyb.x = 0
		if Input.is_action_pressed("up "):
			pohyb.y = jump
		if pohyb.y > 0:
	if Input.is_action_just_pressed("shooting"):
		var shot = scenastr.instance()
		shot.position = $vystrel.global_position
		shot.speed *= directory
	move = move_and_slide(move, Vector2(0,-1))
extends Area2D

export var speed = 2000

func _physics_process(delta):
	position.x += speed*delta

:bust_in_silhouette: Reply From: Game_gulf

make sure you assign the code to kinematic body.

I see 2 different codes. Which of these are you getting an error on?

I getting this error on the first code.

BlinMaker2077 | 2023-04-26 16:51