;```ServerEvents.command(event => {
let command = event.getInput(); // Utilise event.string pour récupérer la commande
let player = event.player;
if (command.startsWith("spawn") || command.startsWith("tpa ") || command.startsWith("home")) {
event.server.runCommandSilent(`execute as ${player.username} at ${player.username} run nm deduct ${player.username} 2`);
}
});```
Hello.
The simple script above returns this error.
[KubeJS Server/]: social/tp_costs.js#6: Error in 'ServerEvents.command': TypeError: Cannot read property "username" from undefined
I don't understand why it's telling me that player is undefined. Could someone help me?
Thanks in advance!