I need some help

Godot Version

3.5.1 stable mono


so i have an enemy node that can shoot, it works perfectly fine, but i am now trying to implement enemies spawning so i put a function in the player that spawns enemies every 5 seconds, again it worked fine, but now when the enemy tries to shoot it gives an error of
Object reference not set to an instance of an object. even though it works fine if i instantiate the enemy using the godot editor and not through code, i made sure that it had the correct parent (the root node) everything seems like it should work but it isnt. i will provide the code to help more but i will only give the relevant parts so it might look odd

    //the initialization of the variables
    PackedScene ebullet_scene = null;
    Spatial ebullet;
   //the ready function
   public override void _Ready()
        ebullet_scene = (PackedScene)ResourceLoader.Load("res://scenes/enemy bullet.tscn");
//the shoot function
public void shoot(){
            ebullet = (RigidBody)ebullet_scene.Instance();
            GetParent().AddChild(ebullet); // the error is here :)
            ebullet.GlobalTranslation = gunhole.GlobalTranslation; //gunhole is a position 3d node to decide where the bullet should be

and thanks in advance.
(if its not already obvious im using c#)


PackedScene scene = null;
public void Load()
    var EbuBullet = scene.Instantiate<RigidBody2D>();
    // Godot 4.x.x
    // Maybe Instance<...>() in Godot 3

still nothing