# How do I unsubscribe from a player event?

**URL:** <https://forums.unrealengine.com/t/how-do-i-unsubscribe-from-a-player-event/835731>\
**Category:** Programming & Scripting\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, question, fortnite\
**Created:** [March 31, 2023, 2:51pm UTC](https://forums.unrealengine.com/t/how-do-i-unsubscribe-from-a-player-event/835731 "2023-03-31T14:51:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Space\_Grouse](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/space_grouse/32/642211_2.png) [@Space\_Grouse](https://forums.unrealengine.com/u/Space_Grouse)\
**Post date:** [March 31, 2023, 2:51pm UTC](https://forums.unrealengine.com/t/how-do-i-unsubscribe-from-a-player-event/835731/1 "2023-03-31T14:51:45Z")

</div>

How do I unsubscribe from an event on a specific element?

Right now I have subscribed to the control change event of a capture area. Later I want to reset that capture area so it can be captured by the same team again, but when I reset the capture area it calls the subscribed event, which throughs everything into disarray. If I can just cancel the subscription between capturing and resetting the capture area everything should work.

---

<div class="post-metadata">

**Author:** ![Tom.Noonan](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Tom.Noonan](https://forums.unrealengine.com/u/Tom.Noonan)\
**Post date:** [March 31, 2023, 3:46pm UTC](https://forums.unrealengine.com/t/how-do-i-unsubscribe-from-a-player-event/835731/2 "2023-03-31T15:46:42Z")

</div>

When you call `Subscribe` on any device events they will return a `cancelable` which you can subsequently call Cancel() on to terminate the subscription.

```auto
hello_world_device := class(creative_device):

    @editable CaptureArea:capture_area_device = capture_area_device{}

    var ControlChangeSubscription:?cancelable = false

    OnBegin<override>()<suspends>:void=

        set ControlChangeSubscription = option{ CaptureArea.ControlChangeEvent.Subscribe(HandleControlChange) }

        # Do whatever logic you like then cancel
        if (Subscription := ControlChangeSubscription?):
            Subscription.Cancel()

```

---

<div class="post-metadata">

**Author:** ![Julianoz1224](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/julianoz1224/32/698263_2.png) [@Julianoz1224](https://forums.unrealengine.com/u/Julianoz1224)\
**Post date:** [May 9, 2023, 7:42am UTC](https://forums.unrealengine.com/t/how-do-i-unsubscribe-from-a-player-event/835731/3 "2023-05-09T07:42:28Z")

</div>

Do you know why I am getting this error and how I could get around it?

 ![SubscribeError](https://d3kjluh73b9h9o.cloudfront.net/original/4X/8/8/5/8853634fba7acb948310566f4db9445433fa7fb2.png)

---

<div class="post-metadata">

**Author:** ![prodkjonsson](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@prodkjonsson](https://forums.unrealengine.com/u/prodkjonsson)\
**Post date:** [May 9, 2023, 8:26am UTC](https://forums.unrealengine.com/t/how-do-i-unsubscribe-from-a-player-event/835731/4 "2023-05-09T08:26:32Z")

</div>

The `EliminatedEvent` is a function so you would need to write `EliminatedEvent().Subscribe(...`.

---

<div class="post-metadata">

**Author:** ![Julianoz1224](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/julianoz1224/32/698263_2.png) [@Julianoz1224](https://forums.unrealengine.com/u/Julianoz1224)\
**Post date:** [May 9, 2023, 9:09am UTC](https://forums.unrealengine.com/t/how-do-i-unsubscribe-from-a-player-event/835731/5 "2023-05-09T09:09:49Z")

</div>

Unfortunately that results in this error:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/3/f/03f4cdf597391598fd5f72d9b9605f5cedd5500a.png)

---

<div class="post-metadata">

**Author:** ![prodkjonsson](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@prodkjonsson](https://forums.unrealengine.com/u/prodkjonsson)\
**Post date:** [May 11, 2023, 12:19pm UTC](https://forums.unrealengine.com/t/how-do-i-unsubscribe-from-a-player-event/835731/6 "2023-05-11T12:19:20Z")

</div>

Depending on how/where you call things and what exact type you need to return you might need to do something like this

```auto
Temp:cancelable = Character.EliminatedEvent().Subscribe(KingEliminated)
set KingSubscription = option{Temp}

```

to satisfy every language requirement.
