codeAPI Reference

s&box IKillSource: Kill feed attacker interface

calendar_today May 12, 2026 schedule ~1 min read person PatrickJr verified 50

IKillSource Interface API Reference

IKillSource is an interface for Components that can appear as an attacker in the kill feed. Implement on Player, Npc, explosive barrels, turrets, or any kill-capable entity.

Type Signature

CSHARP
public interface IKillSource
{
    string DisplayName { get; }
    long SteamId => default;
    string Tags => "";
    void OnKill(GameObject victim);
}

Properties

Methods

OnKill(GameObject victim)

Called on the host when this source kills something. Credit kills, update stats, etc. Default is no-op.

Usage

CSHARP
public class MyExplosiveBarrel : Component, IKillSource, IKillIcon
{
    public string DisplayName => "Explosive Barrel";
    public long SteamId => 0; // Not a player
    public string Tags => "prop";

    public void OnKill(GameObject victim)
    {
        // Credit the kill to the player who placed the barrel
        var ownable = GetComponent<Ownable>();
        if (ownable?.Owner.IsValid() == true)
        {
            // Update player stats
        }
    }

    public Texture DisplayIcon { get; set; }
}

Notes

  • Used by the kill feed system to identify attackers
  • SteamId highlights the attacker's name if it matches the local player
  • Tags can be used for kill feed styling or filtering
  • OnKill is only called on the host
  • Often combined with IKillIcon for custom kill feed icons
Was this helpful?