Opinions on my messaging system

So I want to do messaging system for my game and right now I store the data like this:

local profile = {
 Data = {
  OpenedChats = {
   ["System"]
  },
  Messages = {
   ["System"] = {["ADAWDAWD"]},
   ["Player"] = {["Hi", "Nope"]},
  }
 }
}

This is all like a placeholder, but I would like to hear opinions on how to improve this system
for example, how to store the data better because I feel as if when you have messaged a lot with a player it will get too big for the data store and stuff like efficiency and stuff like that.

Also this is all done with Profile Service module!
And maybe later on I want to also store dates and hours the msg were sent etc…

Code looks good BUT the only thing I personaly would change is the brackets I would use () But cause {[ Looks really ugly (Granted it won’t do anything ingame.)

But will it be efficient? like imagine you now have 100 msg with a player, and like 70 with 10 other players, what should be the maximum saved messages and stuff like that before it gets too inefficient.

I decided to change it to

local Users = {
	["System"] = {
		Messages = {[1] = "Welcome!", [2] = "This is Code Deity!"},
		Responses = {[2] = "Ok"},
		Open = true
	},
}

I think it will work better for future-proofing it.

1 Like

It looks better thanks for taking my advice.