NavigationAgent3D pathing is working but move_and_slide() is not

Godot Version

4.3

Question

I am making a project in Godot 4.3 I am using a gridmap for the map and I have the NavMesh set up correctly, when I am in game I can get it to show me its pathing and it will update correctly accordingly. But for some reason the move_and_slide() function isn’t working at all and my NPC is not moving. Any help would be greatly appreciated.

https://i.sstatic.net/M6shLMsp.png ← Picture of Pathing

Here is the code in my NavigationAgent3D, I can provide more if needed. extends NavigationAgent3D

@export var main : Node
@export var manager_ : Node
@export var hurtBoxCollisionShape : CollisionShape3D
var SPEED = 3.0

var reached_target: bool = true

func _ready():
return
target_desired_distance = hurtBoxCollisionShape.shape.radius

func on_target_reached():
reached_target = true
manager
.entity_state = manager_.ENTITY_STATE.ATTACK
manager_.can_move = false

func _physics_process(delta):
if main and main.player:
target_position = main.player.global_transform.origin
#print ("Player Position: ", main.player.global_transform.origin)

if distance_to_target() > target_desired_distance:
    reached_target = false
    #print("Distance to target: ", distance_to_target())
    manager_.entity_state = manager_.ENTITY_STATE.CHASE

    if not reached_target:
        var current_location = main.global_transform.origin
        var next_location = get_next_path_position()
        var new_velocity = (next_location - current_location).normalized() * SPEED
        set_velocity(new_velocity)

if not main.is_on_floor():
    main.velocity.y -= main.gravity * delta

func _on_velocity_computed(safe_velocity):
main.velocity = main.velocity.move_toward(safe_velocity, .25)
main.move_and_slide(main.velocity)`

You can find working script examples for agents in the documentation here.

If your CharacterBody still does not move check that the collision shape is not placed in such a way that it actuall blocks the character from reaching anything when trying to move along the path points.