Bounty System in Verse failing in Multiplayer Live Session

I’m trying to make a bounty system but it’s not working as intended. This is the current code:

using {/Fortnite.com/Devices}
using {/Verse.org/Simulation}
using {/Verse.org/Assets}
using {/Verse.org/Random}
using {/Fortnite.com/Characters}
using {/Fortnite.com/Game}

# Device for managing Bounty events
bounty_manager := class(creative_device):

    @editable
    TriggerButton : button_device = button_device{}
    
    @editable
    BountyReference : player_reference_device = player_reference_device{}

    @editable
    BountyReward : item_granter_device = item_granter_device{}

    @editable
    BountyTimer : timer_device = timer_device{}

    @editable
    UITimer : timer_device = timer_device{}
    TargetIndex : int = 0

    # Text messages
    StartBountyText<localizes> : message = "Start a new bounty!"

    # UI Canvas
    var BountyOngoing : logic = false

    OnBegin<override>()<suspends>:void=
        # Add start bounty button 
        TriggerButton.SetInteractionText(StartBountyText)
        TriggerButton.InteractedWithEvent.Subscribe(HandleButtonPress)
        UITimer.SuccessEvent.Subscribe(RemoveBountyUI)
        BountyTimer.SuccessEvent.Subscribe(BountyExpired)
        BountyTimer.Disable()
        # Add elimination trigger to all players
        AllPlayers := GetPlayspace().GetPlayers()
        for (PlayerChar: AllPlayers, FortCharacter:=PlayerChar.GetFortCharacter[]):
            FortCharacter.EliminatedEvent().Subscribe(ProcessElimination)

    # Method to start a Bounty
    HandleButtonPress( gamer : agent) : void = 
        AllPlayers := GetPlayspace().GetPlayers()
            
        # Randomly Set a Bounty Target
        PlayerCount : int = AllPlayers.Length
        if (TargetIndex = GetRandomInt(0, PlayerCount-1)):
            Print("Player Count is {PlayerCount}")
            Print("Target index is {TargetIndex}")
            # Register the Bounty target's agent to the bounty reference hologram
            if (BountyTarget := AllPlayers[TargetIndex]):
                Print("Bounty target player set")
                if (BountyFortChar := BountyTarget.GetFortCharacter[]):
                    Print("Bounty target fortcharacter set")
                    if (BountyAgent := BountyFortChar.GetAgent[]):
                        Print("Bounty target agent set")
                        TriggerButton.Disable()
                        BountyReference.Enable()
                        BountyReference.Register(BountyAgent)
                        set BountyOngoing = true
                        BountyTimer.Enable()
                        BountyTimer.Reset()
                        BountyTimer.Start()
    
    # Method to process eliminiations during a bounty
    ProcessElimination( Result : elimination_result) : void= 
        # Get the involved players and the current target
        Eliminator := Result.EliminatingCharacter
        Eliminated := Result.EliminatedCharacter
        BountyTarget := BountyReference.GetAgent()
        Print("Eliminated method was called")

        # Check if a bounty is ongoing
        if (BountyOngoing = true):
            Print("Bounty is ongoing")
            # Check if the eliminated character is the bounty
            if (EliminatedChar:= Eliminated, EliminatedAgent :=EliminatedChar.GetAgent[]):
                Print("Got eliminated agent")
                if (EliminatedAgent = BountyTarget):
                    Print("Bounty target is the deceased")
                    if (EliminatorChar:= Eliminator?, EliminatingAgent :=EliminatorChar.GetAgent[]):
                        Print("got the killer")
                        # Ensuring suicide doesn't grant the target extra gold
                        if (not EliminatingAgent = EliminatedAgent):
                            Print("gave gold")
                            BountyReward.GrantItem(EliminatingAgent)
                        
                        # Close the bounty
                        TriggerButton.Enable()
                        set BountyOngoing = false
                        BountyTimer.Disable()
                        BountyReference.Disable()
                        UITimer.Enable()
                        UITimer.Reset()
                        UITimer.Start()

    # Function to reward the target for surviving
    BountyExpired(gamer : ?agent): void=
        if (BountyOngoing = true):
            Print("bounty is expired")
            # Reward the survivor
            AllPlayers := GetPlayspace().GetPlayers()
            if (BountyTarget := AllPlayers[TargetIndex]):
                Print("got bounty target player")
                if (BountyFortChar := BountyTarget.GetFortCharacter[]):
                    Print("got bounty target fortchar")
                    if (BountyAgent := BountyFortChar.GetAgent[]):
                        Print("got bounty target agent")
                        BountyReward.GrantItem(BountyAgent)

            # Close the bounty
            TriggerButton.Enable()
            set BountyOngoing = false
            BountyTimer.Disable()
            BountyReference.Disable()
            UITimer.Enable()
            UITimer.Reset()
            UITimer.Start()
                
    # Function to remove the bounty UI after completion
    RemoveBountyUI(gamer : ?agent): void=
        UITimer.Disable()

Ignore the print statements, I was testing where the code execution failed in the log
Some notes:

  • In a 2-player lobby, the bounty was ALWAYS using index = 0 and never set the bounty to the other person. However, the PlayerCount was successfully = 2 for a 2-player lobby. TargetIndex just wouldn’t be =1, even after 10 attempts
  • The bounty DOES register the player at index=0 to the reference device, and when the timer expires the targeted player receives the survival reward
  • The execution log does fully complete for the setting bounty method, so that method works fine

The actual issue is the kill; when an elimination occurs, following the print statements, the execution fails at the if (EliminatedAgent = BountyTarget) line. This means the agent i’m getting from the player reference device isn’t the same as the player that is marked as the one that dies. Why is that? What ends up happening is that even if the target dies, the bounty doesnt end and when the timer is up, the target receives the survival reward.

How can I make a proper comparison to the bounty target dying with the player reference device that stores the bounty target? Currently using Verse API Reference and the .digest.verse files, also let me know if there are better resources