How can I make it so when a player is hit it deals 5 damage to the hit player? I dont know why im having so much trouble with this.

Ok so this took me WAYYY too long to work but here’s the fixed code

    var Players : []player = array{}
    OnBegin<override>()<suspends>:void=
        set Players = GetPlayspace().GetPlayers()
        if (Boss := Players[0], FortBoss := Boss.GetFortCharacter[]):
            FortBoss.DamagedEvent().Subscribe(HandlePlayerHit)

    HandlePlayerHit(DamageResult : damage_result) : void =
        Target := DamageResult.Target
        Amount := DamageResult.Amount
    
        if (FortCharacterWhoWasHit := fort_character[Target]):
            Print("Was Hit for {Amount}")
            if(not DamageResult.Source?):
                FortCharacterWhoWasHit.Damage(5.0)

Why does that ^ work, I don’t know. Initially I thought I could just make it so if the instigator was a agent or fort_character it would only work then, turned out damage_result would just give the agent who got damaged as the instigator instead of the agent who damaged them causing an infinite loop I will try to further search this and maybe do a bug report