Welcome to the community! Would you mind having a look at our support article Creating Unique Serial Numbers in Forms. It should solve your issue. As a backup you could also have a look at the post discussed previously (it discusses on how to create a unique id based on the timestamp):