I'm pretty new to scripting, and this might be a terrible idea but can't you do this.
Add this to allplayers
PHP Code:
function onActionServerSide() {
clientr.level == player.level.name;
}
//#CLIENTSIDE
function onPlayerEnters() {
triggerserver( "gui", this.name);
}
And for the allplayers level thing
PHP Code:
for (temp.p : allplayers) {
echo(p.clientr.level);
}