InventoryGui icon indicating copy to clipboard operation
InventoryGui copied to clipboard

GuiStateElement synced across multiple players

Open LaserSlime opened this issue 4 years ago • 2 comments

If I open the same gui for multiple players at once and one of them clicks a GuiStateElement, the Element is changed for the other players too. If I understand this api correctly, the goal is to have one InventoryGui instance that you open for all players. If you need to change something dynamically, you use DynamicGuiElements. If I have to create a new InventoryGui for every player, then why is there a DynamicGuiElement?

LaserSlime avatar May 11 '21 11:05 LaserSlime

Well the library wasn't really designed with such usage in mind (one instance was meant to be self-contained and always provide the same information no matter who viewed it, a new instance was meant to be created per player) so providing different information to different players was an afterthought and that can be done now by using the DynamicGuiElement.

So it's already possible to do what you want: Use a DynamicGuiElement and return the appropriate GuiStateElement per player so I'm unsure if the GuiStateElement really would need to change/be expanded to support that natively as that would just add more overhead.

Phoenix616 avatar May 11 '21 11:05 Phoenix616

That sounds rather complicated. I think creating a new InventoryGui every time would be better.

LaserSlime avatar May 11 '21 12:05 LaserSlime