For my Roblox game I created a custom basic comment section. Players can post their comments that saves so they see each others comments, no matter what public server their in.
But here is the problem:
You join the server, make a comment, leave, then join back, the comment is there but, if you leave then join back the comment is not there.
Or
If you post 2 comments, the last comment you made will save.But the other one doesnt.
Other info:
To save the comment I used the SetAsync()
To load the comment I used the GetAsync()
How do I make it where all the comments a player makes saves and load back on the server when anyone joins?
If anyone will see anyones comments, there could be thousands of comments in a game, which… well, who would read all those? That could cause performance issues as well. If I were you, I would rethink my system a bit. I would use option #2, so that each player can only save 1 comment. However, this may not be the best option depending on the game genre.
It appears that you have forgot about something. There is a limit to how much data you can store in a single datastore key. So eventually you will reach the limit of how much you can store on that one datastore key.
Eventually you will reach a limit. It’s not something that can be shoved into a corner, and forgotten about. Even if it’s not the issue, it still worth pointing it out, so it can be fixed.
You are probably overriding the previous message when using SetAsync(). You need to concatenate the previous comments to the comment that is being submitted. Or if you are using a table to hold together all of the comments, you just use table.insert(commentsTable, currentComment) to append / add the current comment to the last comments. And then when you use SetAsync(), you need to save the commentsTable, or the string that contains the concatenated comments instead of just saving the most recent comment.
Thank you, for some reason I didn’t think about that. I agree, that it would probably be better to have it where each player can save 1 comment, I will implement that into the game.