Hello guys. I have been trying to make party system for a MONTH. One problem were caming along with 10 of others. While I have fixed most of them, I have left with the strangest one. Before, I need describe what I doing in this system:
- Game subdivided into lobby and round.
- When players join a party in the lobby, they will be able to join round together.
- When they are joining round, information about their party is sent along with them - Initial party id, Sender server id, position of players in that party and etc.
- When players are joining round, this info is fastly fetched on server. Server recreates this parties, and when player joins, server puts them in respective party.
- While doing so, server also fires some RemoteEvents, which tell players that
"Player1 joined Party2 and should be inserted at position 3"
- At the same time, client may be in the 2 states:
-
- Player has been loaded, and asks/asked about current party data. All parties, not just one. Server gives that info to player, and it recreates parties on it’s own side. After that, RemoteEvent functions are being connected and ready to use.
-
- Player has not yet loaded, and has no party data, and has no RemoteEvent connection. When he will load, everything in step above will be done.
- After all that operations, I receive a wrong result: For first player who joins party, it gets doubled (So if Party1 consists out of 3 players, and Player1 joins first, he will receive two not fully filled Party1’s datas, like this:
Party1 = {Players={Player1}, Order={1}}
If player is second+ who joins party, he will be greeted with himself being doubled, instead of parties:Party1 = {Players={Player1, Player2, Player2}, Order={1, 2, 2}}
Along with that, Remote tells Player1 that Player2 joins that Party, and result is the following for him:Party1 = {Players={Player1, Player2}, Order={1, 2}}, Party1 = {Players={Player1}, Order={1}},
- This made me come to a conclusion, that either I have done something wrong, or Server waits until Client connects to Remote and then sends that data (or client cashes that remote invokation in hopes of later connecting)
Can anyone help me understand what I did wrong with this logic, please?