Currently creating a party system with the new MessagingService.
When the player leaves the game, the server is supposed to send a message to other servers to remove the player from the party. But, if they’re the last player in the server, that message never gets sent.
After trying many things the only explanation I can think of is that MessagingService is getting disabled the instant there are no players left in the server. The only solution that leaves is to have constant pinging to check if a player still exists, which I would rather not do.
couldn’t you just use something like game:BindToClose
to make sure that message gets sent?
e.g., If you already have a function connected to Players.PlayerRemoving
, you could fire a BindableEvent
when the message is finally sent and connect a :Wait
in :BindToClose
that waits for the BindableEvent
to fire.
You could also have a coroutine that starts in the background that automatically fires the event after a maximum amount of time instead of waiting for the entire 30 seconds.
I tried game:BindToClose before. The message still was not sent. Doing the same things without closing the server worked, so the code itself was not the problem.
1 Like
Found the problem, it was unrelated to MessagingService. The function that sent the leave message also sent a message to the client to update info, but since the player was no longer there it simply stalled.
I had thought of this issue before, and set the function to not send data to the client if the parent of the player is nil, but it turns out the player parent is not set to nil until after the PlayerRemoving event is complete. Didn’t find the issue sooner because I had the servers set to 1 player max.
1 Like