This function parameter expects a value of type ?agent->void, but this argument is an incompatible value of type agent->void.

I’m using a subscribe in elimination manager device
but when it’s Agent:agent I got the error (title)
docs clearly say that I have to use Agent:agent but I just can’t, so how am I suppost to use the device?
image
image

It requires the type ?agent as parameter. You’ll need to cast it to agent inside your function if PlayersMap has agent as key, so that’d be

EliminationManager.EliminationEvent.Subscribe(KillerElimination)

KillerElimination(MaybeAgent:?agent):void=
    if(Agent := MaybeAgent?, CP :CustomPlayer = PlayersMap[Agent]):
        # Your code
1 Like