How to end the game after complete certain event

Hello,
I follow this tutorial https://www.youtube.com/watch?v=sjAJW9l1c6w for practice and I want to end it, when complete the event.
Like when pattern turn to same color, the door is open or something like that.
I read there need add event but I don’t know how. Some say have to put custom event.
I still new for this.