# Why does this code work in OnBegin but not in GetRequest?

**URL:** <https://forums.unrealengine.com/t/why-does-this-code-work-in-onbegin-but-not-in-getrequest/2415085>\
**Category:** Verse\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, question, fortnite\
**Created:** [March 25, 2025, 1:06am UTC](https://forums.unrealengine.com/t/why-does-this-code-work-in-onbegin-but-not-in-getrequest/2415085 "2025-03-25T01:06:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aurum1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Aurum1](https://forums.unrealengine.com/u/Aurum1)\
**Post date:** [March 25, 2025, 1:06am UTC](https://forums.unrealengine.com/t/why-does-this-code-work-in-onbegin-but-not-in-getrequest/2415085/1 "2025-03-25T01:06:42Z")

</div>

Hi everyone,

I’ve been working on this issue for two days, and I still can’t figure out why it’s not working.

Here’s the code:

```auto
    OnBegin<override>()<suspends>:void=
        AllPlayers:=GetPlayspace().GetPlayers()
        for(Player:AllPlayers):
            PlayerButton.Trigger(Player) <--- Works✅
            TestAudioDevice.Play(Player) <--- Works✅

    GetRequest(NewIdx:int, WM: widget_message):void=
        AllPlayers:= GetPlayspace().GetPlayers()
        for(Player : AllPlayers):  
            if(WM.Player=Player):
                PlayerButton.Trigger(Player) <---Doesnt Work❌
                TestAudioDevice.Play(Player) <---Doesnt Work❌
                spawn{StartRequest(Player)} <--- Works✅
                Print("Triggered") <--- Works✅

```

In `OnBegin()`, both `PlayerButton.Trigger(Player)` and `TestAudioDevice.Play(Player)` work fine. However, when called inside `GetRequest()`, they do nothing. Other functions in `GetRequest()`, like `spawn{StartRequest(Player)}` and `Print("Triggered")`, still work correctly.

Does anyone know why this is happening and how to fix it?

---

<div class="post-metadata">

**Author:** ![im\_a\_lama](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/im_a_lama/32/995063_2.png) [@im\_a\_lama](https://forums.unrealengine.com/u/im_a_lama)\
**Post date:** [March 25, 2025, 4:07pm UTC](https://forums.unrealengine.com/t/why-does-this-code-work-in-onbegin-but-not-in-getrequest/2415085/2 "2025-03-25T16:07:58Z")

</div>

Either WM.Player \<\> Player or you’re triggering GetRequest too soon 🤷

---

<div class="post-metadata">

**Author:** ![swaggod](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/swaggod/32/1051181_2.png) [@swaggod](https://forums.unrealengine.com/u/swaggod)\
**Post date:** [March 27, 2025, 6:35pm UTC](https://forums.unrealengine.com/t/why-does-this-code-work-in-onbegin-but-not-in-getrequest/2415085/3 "2025-03-27T18:35:59Z")

</div>

Since the async function StartRequest is working, maybe move the button triggering and audio playing logic into the StartRequest function? If it doesn’t work there then the problem might be with the Player reference you’re using.
