Referencing a Boolean from another script

I have two different scripts. The first script is a simple button that is looking for a clicked. And if it is clicked, to set a boolean that is within it.

public class Seated : MonoBehaviour
{
public bool isSeated=false;
public void clicked()
{
isSeated = true;
Debug.Log(“Was clicked.”);
}
}

Now, the error I am not getting anything as a “void” cannot return anything. When I change the clicked() to a bool, I can’t get it to work properly with the inspector to show that isSeated has been clicked.

When referencing it on the other script, it looks like:

  • private Seated seated;
    seated = GetComponent();
    if(seated.isSeated == true && Drinks.drinksOrdered != true||Drinks.drinksOrdered != false && seated.isSeated == false)
    {
    timer += Time.deltaTime * 1;
    }
    Where am I going wrong? I am sorry if I have asked for this incorrectly. I appreciate the help, guys && gals.

Thanks!

@meat5000, I am sorry that I haven’t gotten back to you sooner. I appreciate the feedback. This did help a lot. I didn’t think that something as simple as a return; would have fixed it. Again, it is appreciated. :slight_smile: