Help with reconnection towards a private place

Hello! Today I’m trying to achieve something I don’t know beyond what to do. I ask of how to create a reconnect function to private servers (the one using teleport service not VIP servers), I don’t want to act and not achieve anything so here’s my guess, I have a datastore so I’m guessing I would just have to save the private server code onto there and have a thing to detect when you try rejoining the lobby. Now were I’m confused, its a match based game so when you rejoin it should be able to detect if the match is still in progress? I’m really stuck and would like at least feedback, at best a script showing how to do it. Thank you for your time.