End game when all coins have been collected

Hello,

I new to unity and coding with C# While attempting to make a game, I wanted to make a script that would enable a game object ( exit to the game) once all the coins had been collected but every attempt I have had seems to not work.
I have attempted to do it with findwithtag and tried referring to the text I use for the score but this ends in failure.

Does anyone know how to do this?

Count them on creation, subtract them on collection, when that counter reaches zero, do the thing you want to do.

You can set the game object to be active or not by using:

your_GameObject.gameObject.SetActive(true); //or false

This will also hide the game object from the scene so if you want to for example enable button without dissapearing it from the scene you can just set if you want to interact with it using

your_Button.interactable = true; //or false

Thanks for the help.