Access variables between 2 scripts

So I’ve been making a 2d platformer game in Unity (c#) and I have a variable in my playerMovement script called “isDashing”, that I want to access in my healthManager script, so that the player would only take damage if the player isn’t dashing.
Code Snippet from playerMovement:

public class Move : MonoBehaviour
    {
        private bool isDashing;
    
        ....
    
    }

Code Snippet from healthManager:

public class health : MonoBehaviour
{
    private bool isDashing;
    void Awake()
    {
        isDashing = GameObject.FindObjectOfType<Move>().GetComponent<Move>().isDashing;
    }

The code didn’t return any errors, but it doesn’t do anything. I’ve already tried out th solutions of other posts, but no luck.
Thanks in advance.

First thing is, any variable that you want to be accessible from outside the script needs to be declared as public instead of private. So the first change should be:

public class Move : MonoBehaviour
{
      public bool isDashing;
      ...
}

And in your health class, this line:

isDashing = GameObject.FindObjectOfType<Move>().GetComponent<Move>().isDashing;

should be simplified to:

isDashing = this.GetComponent<Move>().isDashing;

Using FindObjectOfType and then GetComponent it’s like saying “find an object of type Move and then, nested in it, find another component of type Move”.

PS: It’s better to use GetComponent instead of FindObjectOfType because it’s faster.

Since Move.isDashing is private, I don’t understand how you were able to access it from health object. Which code editor are you using? It was supposed to prevent you from typing that by not letting autocomplete. It should have red underline at that part and you should be able to see that “Move” has not parameter as “isDashing”, in other words, it’s not public so other cannot see it.