Create joinGame function