How do we remove player stats from weak map

Hello, I am having trouble to remove the player saved data when the player leaves the game I found these two videos

and the problem is they use a normal type of map, but I am using a weak map to keep track of the stats so is there a possible way to delete the stats when the player leaves?

OnPlayerRemoved(OutPlayer:player):void=
        if (ActualPlayer := PlayerStatsMap[OutPlayer]):
            var TempAllPlayersMap:[player]player_stats_table = map{}
            for (Key -> Value : PlayerStatsMap, Key <> OutPlayer ):
                set TempAllPlayersMap = ConcatenateMaps (TempAllPlayersMap, map{Key => Value})
            set PlayerStatsMap = TempAllPlayersMap```

If you don’t want to save player data between sessions or rounds you should use a normal map. But if you want to use a weak_map you can something like this should work

OnPlayerRemoved(OutPlayer:player):void=
            if:
                OutPlayer.IsActive[]
                set YourWeakMap[OutPlayer] = player_stats_table{}

You cannot concatenate a weak map so removing a key will not work you can also not loop over a weak map but you can remove the data by just constructing a new class or data type and basically reset the stats and then set the player data to the new created class/data type. OutPlayer.IsActive is also important because if you don’t have it, it can throw a verse runtime error.

If you wanna store data between sessions and round check out this page Using Persistable Data in Verse | Unreal Editor for Fortnite Documentation | Epic Developer Community