So, in my game I want to make a system that adds a number to the "score" variable that works whenever nodes in the "Enemy" group leave the scene. I have a basic script that adds points when any child of the root node leaves the scene, but I need some help to specify the group. The enemy nodes are spawned in rather than already being there when the game starts up. Here's my code:

func _on_child_exiting_tree(node):
	score += 100
	$ScoreLabel.text ="Points: " + str(score)

    Sabir your approach is wrong. Checking whenever a node exits the ROOT and whenever a node is removed from the tree will lead to SERIOUS problems.

    If "enemy" is a node that interacts with anything, it's going to have a script, or something is going to have a script that interacts with the node.
    just put a function in any of the scripts that triggers when they are destroyed, before queue_free().

    for keeping score, use an autoload. an autoload is a script you create in ProjectSettings, this script is global and you can access it's properties from any other script.
    Ex:
    Autoload named Stats:
    var score : int = 0

    Enemy:

    func score_up() -> void:
         Stats.score += 1

    a better aproach is to use a function that adds to the score:

    #autoload
    var score : int = 0
    func add_score(amount : int) -> void:
        score += amount
    #enemy destroyed
         Stats.add_score(1)
         enemy.queue_free()

    that way you can trigger signals or changes whenever the variable has to be changed

    then, in the label, you get the score from the autoload:
    text = "Points : " + str(Stats.score)

    you can do this every frame:

    func _process(_delta) -> void:
         text = "Points :  " + str(Stats.score)

    or use a custom signal emitted by Stats whenever add_score is triggered, but you would have to connect nodes to the signal in the autoload during ready.

    to answer your question, you have the functions add_to_group and is_in_group to set and check the current group of a node.
    https://docs.godotengine.org/en/stable/classes/class_node.html#class-node-method-add-to-group
    https://docs.godotengine.org/en/stable/classes/class_node.html#class-node-method-is-in-group