Ok so I’ve been seeing a lot of chats (In applab) where you have to press a button to see when someone has chatted and you have to press it at the exact moment someone posts if there are multiple users which is really unreliable and just a bad chat overall so here is how you can make a sophisticated chat that actually works.
So first you need a data table you can name it anything but make sure it has three columns “Sender”, “Message”, and “Smessage” and one row with all placeholders in it so you don’t get an error for deleting an undefined message.
After that you will need to make a script for when someone clicks the “send” button. (I cant show the script since I’m on phone and I don’t wanna go through all that hell) The script should make a data table with “Sender”, “Message”, and “Smessage” (meaning saved message) Additionally, you could make a way to detect if the input is blank so that you can’t send a blank message. The Smessage would be the current text in the text area+”\n”+”Sender”+”: “+Message.
Then you can make an onRecordEvent that detects when a new row of data has been created. You would then delete the data table before the one that was just created so that it doesn’t take up space. Since the Smessage contains all of the saved messages it doesn’t matter if everything before the most recent data table was deleted. Then you would update the text area that has the text and set it to Smessage by reading records inside the onRecordEvent.
There you have it. If you want to see the code for yourselves I will make a version of the code in like 3 days max. This method is reliable because you don’t have to spam a receive button and it doesn’t lag computers. This method is not known by the average coder and I’m surprised that there isn’t a yt video on it (correct me if I’m wrong)