Call a function When a bool changes value?

I’m trying to call an animation/sound when a bool becomes true. How can I do that when it changes from false to true and not simply every frame that it is true?

Use properties :

private bool myBool ;

public bool MyBool
   get { return myBool ; }
       if( value == myBool )
           return ;

       myBool = value ;
       if( myBool )
           // Play sound

this is really helpful, thank you @toddisarockstar!

here is a simple answer with an “if” statement if you don’t want to get into custom classes.

    bool mybool;
    bool checkit;
    void Update(){

    print("my bool has changed to: "+ mybool);
//do stuff here