From Onset Developer Wiki
Calls when a player dies by any means possible. If the player wasn't killed by another player, instigator will be the same as the player.
The player that has died.
The player who is responsible for the death.
function OnPlayerDeath(player, instigator) if player == instigator then AddPlayerChat(player, '<span color="#ff0000">You have killed yourself.</>') else AddPlayerChat(player, '<span color="#ff0000">You were killed by '..GetPlayerName(instigator)..'.</>') end end AddEvent("OnPlayerDeath", OnPlayerDeath)