I'm making a private message/notification system for fun. I have most everything down, but there is one bug I haven't been able to iron out. My system works like this: I type a command in the command bar which goes to a global function that takes a variable form the command and turns it into the text of a Message. That Message is put in the player object.
I just realized this is going to take a while to type, I'll just post the code and hope you understand it. If you need help deciphering my messy code just ask for an explanation.
player = game.Players.LocalPlayer
gui = player.PlayerGui["Messages"].TextLabel
iu = false
waiting = {"Don't delete me ;_;"}
deb = false
deb2 = false
removable = true
function tweenin(text)
iu = true
gui.Text = text
gui:TweenPosition(UDim2.new(0.25, 0, .125, 0), "Out", "Quad", 2, false)
end
function tweenout()
gui:TweenPosition(UDim2.new(0.25, 0, -1, 0), "Out", "Quad", 2, false, function()
iu = false
end)
end
player.ChildAdded:connect(function(mes)
if mes:IsA("Message") then
print("Message recieved")
if not iu then
print("not iu")
tweenin(mes.Text)
gui.button.MouseButton1Click:connect(function()
deb = true
tweenout()
mes:Destroy()
wait(.5)
deb = false
end)
else
print("iu")
table.insert(waiting, 1, mes.Text)
repeat wait(1) until iu == false
print(table.concat (waiting, ' '))
print(waiting[1].." going")
tweenin(waiting[1])
gui.button.MouseButton1Click:connect(function()
deb2 = true
tweenout()
if removable then
print("removing") -- When it removes two things from the table this prints once, just like every other time.
table.remove(waiting, 1) -- The only place that anything is ever removed from a table.
print("removed") -- same as above, only prints once
end
removable = false
mes:Destroy()
repeat wait() until not iu
wait(0.5)
deb2 = false
removable = true
end)
end
end
end)
Here's the output:
Message recieved
not iu -- first message starts without having to wait
Message recieved
iu -- is waiting
Message recieved
iu -- is waiting
Message recieved
iu -- is waiting
Gold 300, Experiance 5, Level 1, Don't delete me ;_; -- list of waiting message
Gold 300 going -- is going to be next
removing -- whichever just went gets removed
removed
Experiance 5, Level 1, Don't delete me ;_;
Experiance 5 going
removing
removed
Level 1, Don't delete me ;_;
Level 1 going
removing -- This only prints once, but the last index in the table (don't delete me) disappears without a trace....
removed
Thanks for any information you can give me, LightArceus

2 comments
I'm guessing it is caused by the pause on line 36 being interfered with multiple chat events firing. I am too tired to focus on this to be able to be specific.
I was thinking that was it earlier, but line 37 and 38 only print once the last time when the script removes two items from the table.