# How to subscribe to an event with a \<suspends\> function

**URL:** <https://forums.unrealengine.com/t/how-to-subscribe-to-an-event-with-a-suspends-function/1342533>\
**Category:** Verse\
**Tags:** unreal-engine, unreal-editor-for-fortnite, fortnite-creative, question, fortnite\
**Created:** [October 24, 2023, 4:22am UTC](https://forums.unrealengine.com/t/how-to-subscribe-to-an-event-with-a-suspends-function/1342533 "2023-10-24T04:22:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sly\_Jack](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/sly_jack/32/720354_2.png) [@Sly\_Jack](https://forums.unrealengine.com/u/Sly_Jack)\
**Post date:** [October 24, 2023, 4:22am UTC](https://forums.unrealengine.com/t/how-to-subscribe-to-an-event-with-a-suspends-function/1342533/1 "2023-10-24T04:22:26Z")

</div>

I have a function called ‘LockOn’ that makes a guard that spawns maintain focus on the player. But I can’t figure out how to make a function that subscribe to an event.

The ‘MaintainFocus’ function is what requires the ‘Focus’ function to have .

Is there any way to an asynchronous function subscribe to an event?  
I appreciate any advice. Thanks! 🙏

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/c/e/dcec9625d85fa5f5f0e37230bfe4784cdee755f3.png)

The error message states:  
This function parameter expects a value of type agent-\>void, but this argument is an incompatible value of type type{\_(:agent):void}.

---

<div class="post-metadata">

**Author:** ![SeedohFN](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/seedohfn/32/720959_2.png) [@SeedohFN](https://forums.unrealengine.com/u/SeedohFN)\
**Post date:** [October 24, 2023, 5:12am UTC](https://forums.unrealengine.com/t/how-to-subscribe-to-an-event-with-a-suspends-function/1342533/2 "2023-10-24T05:12:35Z")

</div>

You can’t directly put a function with suspends effect on epic-made devices. You might want to use `spawn{}` inside a function with no suspends effect on it so you can call that function. Here is an example:

```auto
LockOn_start(Guard: agent): void=
     spawn{LockOn(Guard)}

```

---

<div class="post-metadata">

**Author:** ![Sly\_Jack](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/sly_jack/32/720354_2.png) [@Sly\_Jack](https://forums.unrealengine.com/u/Sly_Jack)\
**Post date:** [October 24, 2023, 8:40pm UTC](https://forums.unrealengine.com/t/how-to-subscribe-to-an-event-with-a-suspends-function/1342533/3 "2023-10-24T20:40:15Z")

</div>

Worked like a charm. Thanks!

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [November 23, 2023, 8:41pm UTC](https://forums.unrealengine.com/t/how-to-subscribe-to-an-event-with-a-suspends-function/1342533/4 "2023-11-23T20:41:09Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
