Applying a Script to a parent game object

So I’ve created tower like objects using empty gameobjects to hold the components of my tower. Is there any way to put a script on the parent, which is just holding together the components, such that I can define user behaviour for the whole tower object.
A simple thing I would like to do is print a message when a user clicks on the object.

Drag and drop the script onto the parent game object.

you can use the “gameObject.GetComponentsInChildren(Transform);” function to access the children of a parent object.

access the children of a Transform