Greetings developers,
I am making a custom message system for a group that I was commissioned to make and have came into a situation where the messages, does not delete. But there are no errors…
Client:
-- [ VARIABLES & SERVICES & MODULES ] --
local MessagingModule = require(game.ReplicatedStorage.Core.Modules.MessageModule)
local ChannelModule = require(game.ReplicatedStorage.Core.Modules.ChannelModule)
local RS = game.ReplicatedStorage
local plr = game.Players.LocalPlayer
local CurrentMessages = {}
---------------------------------------------
--// MESSAGES <-- DIRECTORY
-- [This controls the whole messaging-side of the HSC, don't edit unless your advance.] --
--# Sending New Messages
script.Parent.Holder.List.Messages.ChatFrame.EnterButton.MouseButton1Click:Connect(function()
if script.Parent.Holder.List.Messages.ChatFrame.InsideRoom.Value == false then
warn("No channel found, auto-directing to general | Messages [HSC]")
game.ReplicatedStorage.Core.Events.MessageManager:FireServer(script.Parent.Holder.List.Messages.ChatFrame.TextBox.Text)
end
end)
-- Functions
function MoveMessages()
if CurrentMessages[1] then
CurrentMessages[1].Frame:Destroy()
end
local Calculation = 1 - 1
while true do
CurrentMessages[Calculation] = CurrentMessages[Calculation + 1]
if 0 <= 1 then
if Calculation < 20 then
else
break
end
elseif 9 < Calculation then
else
break
end
Calculation = Calculation + 1
end
end
-- Remote Event
game.ReplicatedStorage.Core.Events.MessageManager.Receiver.OnClientEvent:Connect(function(player,content,state)
if state == "newMessage" then
MoveMessages()
local TableOfMessages = {}
CurrentMessages[9] = TableOfMessages
local MessageList = script.Parent.Holder.List.Messages.MessageList
local MessageHolder = MessageList.MessageTemplate:Clone()
TableOfMessages.Frame = MessageHolder
MessageHolder.Parent = MessageList
MessageHolder.Bubble.TextLabel.Text = content
MessageHolder.Title.Text = player.Name
MessageHolder.IconFrame.Icon.Image = "https://www.roblox.com/headshot-thumbnail/image?userId=" .. player.UserId .. "&width=420&height=420&format=png"
MessageHolder.Visible = true
end
end)
Server:
local messagemodule = require(game.ReplicatedStorage.Core.Modules.MessageModule)
game.ReplicatedStorage.Core.Events.MessageManager.OnServerEvent:Connect(function(player,content)
if player and content then
print(content)
game.ReplicatedStorage.Core.Events.MessageManager.Receiver:FireAllClients(player,content,"newMessage")
end
end)
The move message functions basically moves the messages, and if it reaches the max amount of messages (9) it will