Title, used to use this on my previous addons, but it does not seem to work here :(
{
const array = [
"durandal_attack",
"durandal_attack2",
"durandal_attack3",
"durandal_attack4",
"durandal_attack_insta"
];
world.beforeEvents.worldInitialize.subscribe(({ itemComponentRegistry }) => {
itemComponentRegistry.registerCustomComponent("lbr_durandal:trigger", {
onHitEntity(event) {
const player = event.attackingEntity;
player.runCommand(`function ${array[Math.floor(Math.random() * array.length)]}`);
}
});
});
}