Access variables from parents

I’ve tried everything. Everything. There are so many posts, and none of them work. How do I access variables from a parent class. I need help!!

A variable in a class that is attached to the parent?

If that is the case you could use do something like:

gameObject.transform.parent.gameObject.GetComponent<SCRIPT_NAME>().Variable..

Makes sense?

I figured it out.
I had to make a game object in the script that was taking the variables, and then apply the script I wanted to take variables from to that game object through the inspector

So something like this

Private Example example;

GameObject examplevariables;

Start() {
example = examplevariables.GetComponent();
}
Thanks to all who helped