Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

My notification script is broken (tables and events)?

Asked by
sheepposu 561 Moderation Voter
4 years ago

I have a notification system but there are a few problems. It prints 0 to the output till I press the button that triggers the event. It then prints 1 once, and doesn't print anything after that. Thanks in advance for your help on fixing my problem.

local messages = {}

game.ReplicatedStorage.Notification.OnClientEvent:Connect(function(message)
    table.insert(messages, #messages + 1, message)
end)

while true do
    wait()
    print(#messages)
    for _, message in pairs(messages) do
        script.Parent.TextLabel.Text = message
        script.Parent.TextLabel:TweenPosition(UDim2.new(0.349, 0, 0, 0), "Out", "Quad", 1)
        wait(3)
        script.Parent.TextLabel:TweenPosition(UDim2.new(0.349, 0, -5, 0), "Out", "Quad", 1)
        table.remove(messages, 1)
    end
end
0
any errors? OBenjOne 190 — 4y
0
No errors sheepposu 561 — 4y

Answer this question