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

**URL:** <https://forums.unrealengine.com/t/this-function-parameter-expects-a-value-of-type-agent-void-but-this-argument-is-an-incompatible-value-of-type-agent-void/835375>\
**Category:** Verse\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, question, fortnite\
**Created:** [March 31, 2023, 8:55am UTC](https://forums.unrealengine.com/t/this-function-parameter-expects-a-value-of-type-agent-void-but-this-argument-is-an-incompatible-value-of-type-agent-void/835375 "2023-03-31T08:55:49Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ExcapeUE](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ExcapeUE](https://forums.unrealengine.com/u/ExcapeUE)\
**Post date:** [March 31, 2023, 8:55am UTC](https://forums.unrealengine.com/t/this-function-parameter-expects-a-value-of-type-agent-void-but-this-argument-is-an-incompatible-value-of-type-agent-void/835375/1 "2023-03-31T08:55:49Z")

</div>

I am not sure how I can fix this error in my code. This is for the tracker device, I am trying to have it register as an elimination/ promotion in my gun game when users eliminate a guard in the map

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/a/3/1a39e1685b2c209879a8cf6a59dd97b3512ebbb8.png)

---

<div class="post-metadata">

**Author:** ![Syz\_n](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Syz\_n](https://forums.unrealengine.com/u/Syz_n)\
**Post date:** [March 31, 2023, 9:59am UTC](https://forums.unrealengine.com/t/this-function-parameter-expects-a-value-of-type-agent-void-but-this-argument-is-an-incompatible-value-of-type-agent-void/835375/2 "2023-03-31T09:59:49Z")

</div>

`TestPlayerElimination(Agent : agent): void=`

---

<div class="post-metadata">

**Author:** ![Rockclimber36](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Rockclimber36](https://forums.unrealengine.com/u/Rockclimber36)\
**Post date:** [December 22, 2023, 10:15am UTC](https://forums.unrealengine.com/t/this-function-parameter-expects-a-value-of-type-agent-void-but-this-argument-is-an-incompatible-value-of-type-agent-void/835375/3 "2023-12-22T10:15:34Z")

</div>

Did you get this figured out?

---

<div class="post-metadata">

**Author:** ![Safixabs](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Safixabs](https://forums.unrealengine.com/u/Safixabs)\
**Post date:** [December 28, 2023, 2:15pm UTC](https://forums.unrealengine.com/t/this-function-parameter-expects-a-value-of-type-agent-void-but-this-argument-is-an-incompatible-value-of-type-agent-void/835375/4 "2023-12-28T14:15:10Z")

</div>

> [@Syz\_n](#):
>
> (Agent : agent): void=

hello did you figure it out ??

---

<div class="post-metadata">

**Author:** ![SGSensei](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SGSensei](https://forums.unrealengine.com/u/SGSensei)\
**Post date:** [January 20, 2024, 3:28am UTC](https://forums.unrealengine.com/t/this-function-parameter-expects-a-value-of-type-agent-void-but-this-argument-is-an-incompatible-value-of-type-agent-void/835375/5 "2024-01-20T03:28:40Z")

</div>

Figured out the issue after coming here for a quick google search.

Let me give a basic rundown. My usage involved listening to when a sentry was eliminated, and playing a custom sound based off of this event firing. The sentry class has a listenable .EliminatedEvent, that can be .Subscribe() to. The problem arrises with the parameters the method expects.

The error clearly states that the method is expecting a type of ?agent to be fed in, but its being fed in agent. What does this mean? The ? syntax denotes an optional value. Why is agent optionable here? Because an agent doesnt necessarily have to be the instigator of the elimination.

So if I have a method called “BotElimSound” that I want to play when a sentry is eliminated, I subscribe it like so

```
    sentry.EliminatedEvent.Subscribe(BotElimSound)

```

But in the definition of BotElimSound, I must define the agent param being passed in as an optional.

``  
`

> BotElimSound (Agent:?agent) : void =  
> fullElimSound.Play()

Notice the ? before the agent type, this makes agent optional, which will fix your error.

---

<div class="post-metadata">

**Author:** ![SGSensei](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@SGSensei](https://forums.unrealengine.com/u/SGSensei)\
**Post date:** [January 23, 2024, 6:46pm UTC](https://forums.unrealengine.com/t/this-function-parameter-expects-a-value-of-type-agent-void-but-this-argument-is-an-incompatible-value-of-type-agent-void/835375/6 "2024-01-23T18:46:13Z")

</div>

Actually your problem is the opposite issue, so you just gotta remove the ? from your method definition. This is because the Guard.CompletedEvent can only be instigated by an agent, therefore it is impossible to pass an ?agent to it. Which is what you define as possible in your “TestPlayerElimination(Agent: ?agent)” method by having the ? before the agent type.

---

<div class="post-metadata">

**Author:** ![Gui\_CL](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/gui_cl/32/1130391_2.png) [@Gui\_CL](https://forums.unrealengine.com/u/Gui_CL)\
**Post date:** [December 31, 2025, 8:41pm UTC](https://forums.unrealengine.com/t/this-function-parameter-expects-a-value-of-type-agent-void-but-this-argument-is-an-incompatible-value-of-type-agent-void/835375/7 "2025-12-31T20:41:06Z")

</div>

This saved me, thanks!
