If changing from one scene to another using get_tree().change_scene_to_file() then you may have to make your fade to black animation a Global/Autoload, or add as a child of get_tree().root to use it temporarily, or use two AnimationPlayers with one fading to black, and the other fading from black once the scene loads.
Hello! In my game, I implemented this by adding a global parent game for all game scenes and placing a black stub rectangle in this node. I change its transparency using Tween. The music attenuation control logic is also located in the root node (this is implemented by smoothly changing the volume in the main bus).
To refer nodes to the parent of the desired type, I use an auxiliary method that checks the parents of the current node along the chain.
public static T Closest<T>(this Node node) where T : Node
{
Node parent;
if ((parent = node.GetParent()) != null)
{
return parent as T ?? parent.Closest<T>();
}
return null;
}