Removing custom UI after specific event.

This is my code now.
Doesn’t work anymore…
I don’t know if i’m doing this right, i think i don’t understand where you expect me to place these lines of code :sweat_smile:

var TextWidget : text_block = text_block{DefaultTextColor := color{R:=1.0, G := 1.0, B:= 1.0}}

    OnBegin<override>()<suspends> : void =
        # S'abonner à l'événement de téléportation
        TeleportDrop.TeleportedEvent.Subscribe(WrapOnPlayerTeleported)
        EliminationManager1.EliminationEvent.Subscribe(OnPlayerElimination)

        var PlayersUI : []player = GetPlayspace().GetPlayers()
        set AllPlayersCount = GetPlayspace().GetPlayers().Length
        var PlayersTP : string = ToString("{PlayersTeleported}/{AllPlayersCount}")
        


        for(Player : PlayersUI):
            AddUIToPlayer(Player)
        
        
        loop:
            Sleep(0.1)
            for(Player : PlayersUI):
                if(FortniteCharacter : fort_character = Player.GetFortCharacter[]):

                    UpdateUI()

    SetCanvasVisiblity(ThisPlayer: player, bVisible: logic): void =
        var PlayersCustomCanvas: [player]canvas = map{}
        if (CustomCanvas := PlayersCustomCanvas[ThisPlayer]):
            if (bVisible?):
                CustomCanvas.SetVisibility(widget_visibility.Visible)
            else:
                CustomCanvas.SetVisibility(widget_visibility.Hidden)

    AddUIToPlayer(Player : agent) : void =
        var PlayersCustomCanvas: [player]canvas = map{}

        for (thisPlayer: Self.GetPlayspace().GetPlayers()):
            if (PlayerUI := GetPlayerUI[thisPlayer]): 
                var NewCanvas: canvas = CreateUI()               
                PlayerUI.AddWidget(NewCanvas)
                if:
                    set PlayersCustomCanvas[thisPlayer] = NewCanvas
               then:
                    SetCanvasVisiblity(thisPlayer, true) 
    
    CreateUI() : canvas =
        var PlayersCustomCanvas: [player]canvas = map{}
        UpdateUI()
    
        
        userInterface : canvas = canvas :
            Slots := array:
                canvas_slot:
                    Anchors := anchors{Minimum := vector2{X := 0.0, Y := 0.5}, Maximum := vector2{X := 0.0, Y:= 0.5}}
                    Offsets := margin{Top := 300.0, Left := 0.0, Right := 0.0, Bottom := 0.0}
                    Alignment := vector2{X := 0.0, Y := 1.0}
                    SizeToContent := false
                    Widget := TextWidget
        return userInterface 

    UpdateUI() : void =

        Print("Update UI")
        var PlayersTP : string = ToString("{PlayersTeleported}/{AllPlayersCount}")
        TextWidget.SetText(GetPlayerListTP(ToString(PlayersTP)))

        
    GetPlayerListTP<localizes>(PlayersTP2 : string) : message = "TOTAL PLAYERS QUALIFIED FOR THE NEXT ROUND : {PlayersTP2}"