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

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:

    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?

Either WM.Player <> Player or you’re triggering GetRequest too soon :person_shrugging:

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.