Home / Lua / Events / Client / LocalPlayerDeath

Name    LocalPlayerDeath
Arguments (in table)    Player attacker, DamageEntity type
Return option    None

Description

Fired when you die. attacker is not guaranteed to exist.

Examples

damageTypes = {
	"Physics",
	"Bullet",
	"Explosion"
}

Foo = function(args)
	local message = tostring(args.attacker).." killed you with damage type "..
		tostring(damageTypes[args.type])
	print(message)
	Chat:Print(message, Color(255, 255, 255))
end

Events:Subscribe("LocalPlayerDeath", Foo)