By opening and closing a PlayerInventory, a player spawns or leaves the server. On server side, opening and closing invwntory means whether the Player is viewing it. You always view your inventory, since you always have a hotbar. But for a chest, you stop viewing it when you close the chest using the close button.