"Can't add child, already has parent" error when creating bullet

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Eldirish
:warning: Old Version Published before Godot 3 was released.

Hey everybody, I’m trying to spawn a bullet upon clicking the mouse. The problem is the bullet is spawned once and after that the engine doesnt instantiate more with the error “Can’t add chil, already has parent”.

Here is the code that instantiates the bullet scene:enter image description here

and here is the scene it is being called to: Right Gun is whats callid the shooting script

What am i doing wrong, I’ve followed the simple shooter sample project?

:bust_in_silhouette: Reply From: Eldirish

[FIXED] Had to use instance the in add_child() so the code became:

var bullet = preload("blal")

func shoot():
 get_tree().get_root().add_child(bullet.instance())