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

What's the most efficient way to make a Chat log?

Asked by 9 years ago

I've tried doing a chat log using Tables and bindable functions,but it didn't turn out very efficient and the tables would mess up the order if someone chatted,so whats the most efficient way to make a Chat log or to make this thing more efficient?

Heres the Hierarchy

My Test Chat Log thing:

Chatlog = {}
------------------------------
InsertChat = script.InsertChat
PrintChatLog = script.PrintChatLog
------------------------------
function InsertChat.OnInvoke(Chat,Boolean)
        if Boolean == true then
            table.insert(Chatlog,#Chatlog,Chat)
            return Chat
        end

end
------------------------------
function PrintChatLog.OnInvoke()
        for i,v in pairs (Chatlog) do
            print(v)
        end

end
------------------------------

Separate script:

game.Players.PlayerAdded:connect(function(Player)
    Player.Chatted:connect(function(Message)
        ------------------------------------------------
        InsertChat = game.workspace.ChatLog.InsertChat
        PrintChatLog = game.workspace.ChatLog.PrintChatLog
        ------------------------------------------------
        InsertChat:Invoke(Message,true)
        wait()
        PrintChatLog:Invoke()
        end)
end)

I use the output in my place to test it.

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

i realize this is a very old post but this will help if people look at the post. this thread might help if you're willing to use discord. https://scriptinghelpers.org/questions/64504/why-wont-my-join-logchat-log-script-work-in-the-real-game

Ad

Answer this question