Hey everyone! I’m planning on making a custom admin system. I want to implement shutdownlogs, chatlogs, command logs, joinlogs and helplogs (when someone uses a !help command), though I’m not sure how I should store this information and then load it to everyone’s UI. Using a RemoteEvent would work, but that would not be worth running every time a user uses a command or chats for example. Someone spamming will not be a good one. So, what do you think is the best lag-free & fast way of doing this? Any help is appreciated, thanks!
I’ve seen this with almost all admin commands, for example HD Admin and BAE.
If you’re worried about spamming you can add a cooldown for executing commands. You could also try updating the log contents one by one with X delay to make sure the remote event isn’t fired constantly.(It’s like a queue system. Logs get added to a queue before being added to the main logs table. They are added to logs one by one with a short delay.)
Is all of this information just going to be stored on the server or are you going to DataStore or use HttpService to somehow store the information?
If it’s just stored on the server, I would personally just store everything. With chat logs this also helps you realize why an admin kicked someone (they were spamming). You wouldn’t have to really worry about RemoteEvents because you can tell when someone chats on the server and don’t have to invoke it extra times, similarly you can set the GUI text in the server when recalling the log information from the server.
With shutdownlogs though they would have to be stored through some DataStore because otherwise you wouldn’t have any record of the shutdown because it was destroyed with the server.
I plan on storing it on the server, shutdownlogs in a Datastore. Should I save this stuff in a table? Then when a player opens the gui, it takes the info from the table, seperates the table contents into positions on the UI.
To store the data I would put it in a table similar to this:
local CHAT_LOG_MAX_STORED = 1000
local chatlog = {}
plr.Chatted:Connect(function(msg)
-- If too many messages, delete the oldest
if #chatlog >= CHAT_LOG_MAX_STORED then
table.remove(chatlog, #chatlog)
end
-- Insert at the front of the log so it starts with most recent msg, you can ipairs this to show most recent messages first
table.insert(chatlog, 1, {Message = msg, Player = plr, Time = os.time()}
end)
Then whenever an admin requests chat logs, you pass however much of the table you would like to show them, and put it in their GUI.