import { world, Items, ItemStack } from "mojang-minecraft"
import { system } from "mojang-minecraft";
import { MinecraftEntityTypes, DynamicPropertiesDefinition } from "mojang-minecraft"

function onHardcoreeath() {
    let players = world.getPlayers()
    for (let player of players) {
      let playerHealt = player.getComponent("minecraft:health").current
      let isDeath = player.hasTag("death")
     if(playerHealt == 0 && isDeath == false){
        player.addTag("death")
        player.runCommand('function hardcore')
     }
  }
  }


  world.events.tick.subscribe(onHardcoreeath)