muzzle.add_child(b)
Means that Godot will fetch the content of the variable muzzle
(which is supposed to be a node) and will call the function add_child
from it.
But, if you never told Godot what is the content of the muzzle
, Godot does not know what to do, and will tell you that you are trying to call add_child
on nothing.
You can assign a node to muzzle in many different ways, depending which node is referring to:
Muzzle=$NameOfChildNode
Muzzle=get_parent()
Muzzle=get_node(path)
Muzzle=get_child(n)