C# Access Script in Closest Object

Basically, I’m trying to chop down trees using AI. I have multiple objects in the scene with the same name, but the tag “tree”.
My pathfinding finds the closest object with the tag “tree” and walks over to it. Now, I need to check if the tree he is near has fallen. My logic is to access the script attached to the closest tree and run a function to check this status.

My question is, if I use GameObject.FindGameObjectWithTag(“Tree”) and assign that to a new GameObject, how can I access the individual script within this GameObject and not all scripts attached to the general tree prefabs?

What you are looking for is the command GetComponet
say the GameObject tree is your tree you are targeting,

example:

yourScriptNameHere yourScript = tree.GetComponent < yourScriptNameHere> ();

yourScript.aMethod();

this allows you to access a certain script that a GameObject has and call its methods. access its public variables.