How to use weak_mapv

Hello
Im coding verse for NPC controll and the code I attached is trying to store agent of the spawned NPCs.When I try to call NPCAdded and trying to store to weak_map, Its failing to store.
What is wrong about this code?
Thank you in advance and sorry for poor english

I haven’t played with weak_map with session as the key yet, but is it possible that agent isn’t a supported persistent type?

If that’s the case you could try storing a custom class that contains your array of NPCs instead?

1 Like