#Idk how to get player name

2 messages · Page 1 of 1 (latest)

thick drum
#

sry, i am first time try to using kubejs and i never use javascript before. And i wrote a code, that join player to a command when he connect to a server, but i cant understand how to get player name into string/how to get player name.

my crappy code:

PlayerEvents.loggedIn(e => {                                                                                       const player_name = event.player.name.getString();      
   if(!event.player.stages.has('command')) { 
    if(!event.player.stages.has('has_command'))
      event.player.stages.add('has_command');
      Utils.server.runCommandSilent('team join ' + player_name ' players');
}                                                                                                                 Utils.server.runCommandSilent('tell @a ' + player_name ' hi' ); // debug print
})```
spark jayBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!