#crates system
1 messages · Page 1 of 1 (latest)
yes
yes
wait
so these
need } else if (crates === 1) { const inventory = player.getComponent("inventory").container; const chest = player.dimension.getBlock({ x: 307, y: 115, z: 309 });
the coords are where the crate loot
anything else?
or just that?
maybe the items as they are custom?
oh okay
import { world, system, Player } from "@minecraft/server";```
event.cancel = true;
});
export function getScore(player, objective) {
return world.scoreboard.getObjective(objective).getScore(player);
}```
shouldnt..
change the items
project:common_crate
yes
if (key.typeId !== "project:project_crate") return;
player.sendMessage("§7[§c!§7]: §aOpened project crate!")
player.runCommandAsync("clear @s project:project_crate 0 1")
player.runCommandAsync("playsound random.levelup @s").then(() => {
const chestInventory = chest.getComponent("inventory").container;
const random = (Math.random() * 27) + 1;
const number = Math.floor(random);
const item = chestInventory.getItem(number);
system.runTimeout(() => {
inventory.addItem(item);
}, 1)
})
}})
};```
thats there
idk
@plush glen is this working in 1.21?