My code works sometimes but it’s inconsistent and changes everytime. Why does this happen???
I tried implementing a system to prevent random numbers for being selected twice but the code is still inconsistent.
If you don’t like random numbers why are you generating them?
I want to generate a random code for lobbies.
…I guess I don’t need random numbers but I like the idea of them so i’m using them here.
You are not generating unique ID lobbies (just random ones), so, you can get lobbies with the same ID (which can cause overwrite).
lobbyFindServer function assumes that
lobbies is never empty when searching for an existing lobby. If
lobbies is empty, the
for (i in lobbies) loop will not run, and
lobbyMakeServer(Id2) will not get called.
And I suggest making
lobbyId a local variable too.
I found the solution after experimenting on my own, the problem was
Object.keys(lobbies) wasn’t counting the amount of lobbies but it was fetching the LobbyId. This was fixed by doing
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.