How do I make a block necessary to complete a level?

For context, I have a chest that I want people to collect before they are able to finish the level. There is a flag at the end that teleports you to the next level. How do I do that?

That can be done with a switch. Can you send a game link?

As @USERNAME55 said, you can use a switch. The way this would work:

You have a switch that turns on when you collect the chest. When you touch the flag, input THROUGH the switch to the next level teleport. So if you touch the flag without collecting the chest, nothing will happen because the switch is off.

I can provide a screenshot if you want

Yeah, @johnpost made it more clear. That is how you do it.