Broadcasting message to multiple children

I am having trouble using broadcast message to deselect and deparant multiple objects.

when selected the gameobjects are parented to a gO named “selected”
and upon clicking on terrain or single unit, all selected parents are set to 0.

[Sender]…

if(Physics.Raycast(ray, hit))
        
            if(hit.transform.CompareTag("UNIT")){
           	selected.BroadcastMessage("Deselect",options);
            hit.transform.BroadcastMessage("Select",options);
            }	
            if(hit.transform.CompareTag("Terrain")){
            selected.BroadcastMessage("Deselect",options);
            }

[Reciever]…

function Select () {

	selected = true;
	transform.parent = selectionParent;
}

function Deselect() {

	selected = false;
	transform.parent = null;
}

But for some reason only one or two is deselected at a time???

If you are reparenting them just to keep like a list of them, use an array or list instead. Only reparent if you really need to have them move or behave as a group. For example, if you had two flocks of birds and you wanted to move some birds from one flock to another. If you’re just keeping track of ‘selected or not’ why not just examine your ‘selected’ vars? Also consider using layers or tags.