iv'e got a problem

extends CharacterBody2D

@onready var Player = get_node(“/root/Game/Player”)

func _physics_process(delta):
var direction = global_position.direction_to(Player.global_position)
velocity = direction * 300.0
move_and_slide()

i can’t understand why it doesn’t work can you help

Have you confirmed that it is properly referencing Player?

Use print statements to test direction and Player var.

print(Player,direction) place it after declaring your direction variable.

This is a basic debugging process. You need to figureout where your code is failing. Also if you want more information place a print(velocity) after you write your velocity code.