I tested this code and it has an infinite loop, activating and deactivating without stopping.
I think the interesting thing would be to make the check be done again, calling this loop, every time a player advances in level or when a new player joins the party, just once, every time this...