How to check if there is any player idle if not make user to play with bot

Options
I want a system like 8BallPool where they show the scrolling UI and the user image with which I will connect, if there is no user available then a bot should be spawned with me.

How can I achieve this?
1. To show a scrolling UI before the players connect.
2. To check if there is user available if yes then create a Room and let the two users play if not then Let the user play with a bot.

I just want to know how can I achieve this and the functions to check the availability of the user.
Thanks

Comments