import { world, system } from "@minecraft/server"
world.afterEvents.playerSpawn.subscribe((niy) => {
  const player = niy.player
  player.addTag("red")
})
system.runInterval(() => {
  for (const player of world.getAllPlayers()) {
    if (player.hasTag("actu")) {
      world.sendMessage("Make sure to stay warm or u may freeze to death!")
      player.runCommand('playsound staywarm @s')
    }
  }
}, 6000)
