Creating an advanced messaging system

Howdy devs,

I thought of the idea of creating a UI-based game where you can direct message anyone in roblox, the experience consists of searching the user’s username and talking with them, even if they are offline.

My script concept is, whenever a player clicks on the search result, it fires a remote function, the remote event will handle the data, which will get it and returns it to the client as a dictionary.

The dictionary is something similar to this example right here:

local conv = {
   [messageText] = {["Order"] = 2; ["Sender"] = "ItsBloxyMan"
}

When returning it to the client, it will arrange all the messages inside the dictionary depending on their order, if the sender was the local player, it will appear as blue, and if not, it will appear as yellow.

Each time the player sends a message, the same remote function fires, adding a new array to the dictionary, with the same properties.

When the player leaves or exits the conversation, the whole conversation saves.

Any idea how can I make this code more practical and efficient? Thanks.

(basically I wanna recreate the messaging system from royale high :slightly_smiling_face: )

2 Likes

You can use profileservice’s global updates. They’re slow though, so perhaps it should use messaging service first, and if that fails (player isn’t online), use ProfileService’s global updates to make sure the receiver gets the message after they join.

1 Like

Not exactly part of your main problem but imo the index of the value should be the order instead of the message since that would mean you can’t send two different messages with the same text

1 Like