#Help me plis

1 messages · Page 1 of 1 (latest)

gentle valley
#
world.afterEvents.entityDie.subscribe((event)=>{
  const{damageSource,deadEntity}=event;
  let Player = damageSource.damagingEntity
  let Deadplayer = deadEntity
  for (const player of world.getPlayers(Player)){
  Deadplayer.runCommand(`say §cYou have been killed by ${player.name} using ${player.getComponent('inventory').container.getItem(player.selectedSlot).typeId.split(':').pop}`)
  }
})
dusky etherBOT
#
No Errors

No errors in [code](#1117468451997483051 message)

junior cove
gentle valley
#

np

junior cove
junior cove
tall raptor
junior cove
#

uh

junior cove
tall raptor
#

Why what happened

gentle valley
gentle valley
gentle valley
# junior cove bro no work (no funciona) 😦

here ```js
world.afterEvents.entityDie.subscribe((event)=>{
const{damageSource,deadEntity}=event;
let players = damageSource.damagingEntity
let Deadplayer = deadEntity

for (const player of world.getPlayers({type:players})){
let item = player.getComponent('inventory').container.getItem(player.selectedSlot).typeId.split(':').pop()
if (Deadplayer instanceof Player){
Deadplayer.runCommand(say §cYou have been killed by ${player.name} using ${item})
}
}
})```if you don't want it to say it to mobs that they have been killed by the player, then use this one