I am trying to run scoreboard players get list ${ev.sender.name}
to get the value of an list called money, but I wasn’t able to find a way to get the output of the command.
So I tried running the following:
import { world, system } from "@minecraft/server";
world.beforeEvents.chatSend.subscribe(ev => {
try {
system.run(() => {
const resultFull = system.runCommand(`scoreboard players list ${ev.sender.name}`);
result = resultFull.statusMessage;
});
ev.sender.sendMessage(`Get result: ${result}`)
} catch (e) {
ev.sender.sendMessage(`Failed to run with error: "${e}"`);
}
});
but the code returned Get result: undefined
.