1. Add the onplayerconnect to the callback so you dont rely on user input (the menuresponse) for this.
2. The second part of your script does not know which thing "self" is. I guess you havent run this with developer enabled?
3. printf is your friend. Print everything that you are not 100% sure has the correct value. Kick/ban yourself to simulate.