Problems with state changes and global_position

Godot Version

4.7.2

Question

I took a break from trying to learn coding so it might be a miner slip up but when I tried testing the chase state for my enemy they wouldn’t move despite the fact that it saw me and knew what to do when it sees me, I thought it was because there was repeated code in the scene with the navigation stuff being in the enemy’s code and the chase state code but when I deleted it like how the tutorial told me the script lost its global_position, does anyone know what to do if not maybe recommend a different tutorial ?

extends State
class_name EnemyChase

@onready var enemy: CharacterBody3D = get_parent().get_parent()
var player: CharacterBody3D = null

# Called when the node enters the scene tree for the first time.
func _ready() -> void:
	player = get_tree().get_first_node_in_group("player")


func process(_delta: float) -> void:
	enemy.navigation_agent.set_target_position(player.global_position)
	
	if enemy.global_position.distance_to(player.global_position) > enemy.ChaseDistance:
		emit_signal("Transitioned", self, "EnemyWander")

func physics_process(_delta: float) -> void:
	if enemy.navigation_agent.is_navigation_finished():
		return
	
	var next_position: Vector3 = enemy.navigation_agent.get_next_path_position()
	enemy.velocity = enemy.global_position.direction_to(next_position) * enemy.RunSpeed

What tutorial are you using? What is your state code? What is your enemies code and node structure? We literally know nothing about your project and it’s very difficult to help out like this.

I’m using Apple Minecraft’s "make better 3d enemy by state machine - enemy part 2

the different states are children of a state machine all with the chase currently in the inherited slot

enemy’s code

extends CharacterBody3D

@export var WalkSpeed: float = 1.5
@export var RunSpeed: float = 4.0
@export var AttackReach: float = 1.5
@export var ChaseDistance: float = 10.0

@onready var navigation_agent: NavigationAgent3D = $NavigationAgent3D

var player: CharacterBody3D = null

func _ready() → void:
var players = get_tree().get_nodes_in_group(“player”)
if players.size() > 0:
self.player = players[0]
print(“found player:”, player.name)

func _physics_process(_delta: float) → void:
move_and_slide()

func on_death() → void:
queue_free()

I would check if your enemy enters the chase state in the first place. use print() maybe?