I was trying to design a script to detect when a player disconnects from Mesh. I made one but it isn't very efficient when a high number of players go online. My script involved a variable that is constantly changed by -1 when a player joins the mesh. The player who joined continously broadcasts "Renew" and when "Renew" is received, the variable is changed back to 20. When the variable reaches 0, the player is disconnected. Is this the only way? Or is there a more efficient method? Thanks a lot!
Offline
itsmomito wrote:
I was trying to design a script to detect when a player disconnects from Mesh. I made one but it isn't very efficient when a high number of players go online. My script involved a variable that is constantly changed by -1 when a player joins the mesh. The player who joined continously broadcasts "Renew" and when "Renew" is received, the variable is changed back to 20. When the variable reaches 0, the player is disconnected. Is this the only way? Or is there a more efficient method? Thanks a lot!
Since Scratch doesn't tell the project that a user has disconnected or joined, that is probably the best way. You could infinitely check a sensor-value to see if it's not 0. Though I think Scratch retains the oldest value of the sensor-value, so that probably wouldn't work.
Offline