What im trying to do
Im trying to make a functional compose message script to send to other players accordingly.
Information! (Warning, a lot)
Consider the following concept:
My Problem:
I am trying to make a Roblox Mailing system
What I want done:
I want the mailing system to be fully operational and work for people to send messages to each other
Features:
-
I want the mailing system to work for two parties, for instance, a player can send a message to someone and they recieve it and can reply if they’d like
-
I want the composing system to have a max amount of words
Explorer locations:
Compose Page = StarterGui(Service) → MainGui(ScreenGui) → MainFrame(Frame) → MainFrameHolder(Frame) → MailboxPage(Frame) → Compose(Frame)
Compose Page Children = MailFrame(Frame), RecipitentFrame(Frame), Title(TextLabel)
MailFrame Children = UICorner(UICorner), Mail(TextBox), SendButton(TextButton), RecipientPerson(ImageLabel), AmountToMaxWords(TextLabel), RecipitentDisplayName(TextLabel), RecipitentOriginName(TextLabel)
RecipitentFrame Children = UICorner(UICorner), RecipitentSearchBar(TextBox), RecipitentPerson(ImageLabel), RecipitentDisplayName(TextLabel), RecipitentOriginName(TextLabel), RecipitentTitle
Inbox Page = StarterGui(Service) → MainGui(ScreenGui) → MainFrame(Frame) → MainFrameHolder(Frame) → MailboxPage(Frame) → MailboxInbox(Frame)
Inbox Page Children = UICorner(UICorner), Container(ScrollingFrame), DescLabel(TextLabel), NameLabel(TextLabel), Title(TextLabel), TopicLabel(TextLabel)
Explorer Descriptions:
Compose Page = The frame that I have to act as a background for my compose page to compose a message to somebody else
Compose Page Children MailFrame = The background for the message the character is going to send to somebody else
ComposePageChildren RecipitentFrame = The background for the recipitent frame, which is the frame to show who the message is going to be recieved by
ComposePageChildren Title = The title of the page
MailFrame Children UICorner = A decorative aspect for the UI
MailFrame Children Mail = The textbox where the player can write their message to somebody else
MailFrame Children SendButton = The button a player can press when they are done writing their message and are sending the message to somebody else
MailFrame Children RecipitentPerson = The image of the other player the player is going to send the message too
MailFrame Children AmountToMaxWords = The counter of the bottom right hand side of the screen for the player to see how many characters they have written in comparison to the max amount of characters
MailFrame Children RecipitentDisplayName = The other players display name the player is sending too
MailFrame Children RecipitentOriginName = The other players original name the player is sending too
RecipitantFrame Children UICorner = A decorative aspect for the UI
RecipitantFrame Children RecipitentSearchBar = The textbox where people can search for a player to send too
RecipitantFrame Children RecipitentPerson = The image of the other player the player has searched up to send the message too
RecipitantFrame Children RecipitentDisplayName = The other players display name the player has searched up and is sending too
RecipitentFrame Children RecipitentOriginName = The other players original name the player has searched up and is sending too
RecipitantFrame Children RecipitentTitle = The title of the page
Inbox Page = The page where the other player can see what the player has sent to them
Inbox Page Children UICorner = A decorative aspect for the UI
Inbox Page Children Container = The scrolling frame to see what everyone has sent to the player
Inbox Page Children DescLabel = The title that shows the short tidbit of information collum
Inbox Page Children NameLabel = The title that shows the name of the player who sent you the message collum
Inbox Page Children Title = The title of the page
Inbox Page Children TopicLabel = The title that shows the title of the message the player sent to you
My current script:
-- Inside Compose Frame
local MailTextBox = script.Parent.MailFrame.Mail
local SendButton = script.Parent.MailFrame.SendButton
local MaxCharacterLimit = 500 -- Adjust as needed
-- Function to update character count label
local function updateCharacterCount()
local messageLength = string.len(MailTextBox.Text)
script.Parent.MailFrame.AmountToMaxWords.Text = tostring(messageLength) .. "/" .. tostring(MaxCharacterLimit)
end
MailTextBox.Changed:Connect(function()
local messageLength = string.len(MailTextBox.Text)
if messageLength > MaxCharacterLimit then
MailTextBox.Text = string.sub(MailTextBox.Text, 1, MaxCharacterLimit)
end
updateCharacterCount()
end)
SendButton.MouseButton1Click:Connect(function()
local message = MailTextBox.Text
-- Placeholder for local recipient information
local localRecipient = {
DisplayName = "JohnDoe123",
OriginName = "JohnDoe123",
-- Add other recipient information as needed
}
if message ~= "" and localRecipient then
-- Placeholder: Code to send the message to the local recipient
print("Message sent to recipient:", localRecipient.DisplayName)
else
print("Error: Message or recipient information is missing.")
end
end)
-- Update character count label initially
updateCharacterCount()
What I want done first:
How can I make the localRecipitant work for all different people, instead of having to write out their names?