How do I force a user to enter their name

Does anybody know how to make a user enter their name in a text box. I’ve tried if else on the enter button but that didn’t seem to work?