I know that there are several other posts about this but i couldn’t read any help out of these, so i am trying to achieve something that logs a kick into a datastore, which means i’d have to insert a table into a datastore table, the problem is that i don’t know how to do this.
--Script above is not important.
else
local LogsTable
local LogsTemplate = {[os.date('%c',os.time())] = "Invoked AdminFunction without the matching permission."}
local Success,ErrorMessage = pcall(function()
LogsTable = KicklogDatastore:GetAsync(KicklogKey.. Player.UserId)
end)
if Success then
if LogsTable then
table.insert(LogsTable,#LogsTable+1,LogsTemplate)
local Success,ErrorMessage = pcall(function()
KicklogDatastore:SetAsync(KicklogKey..Player.UserId,LogsTable)
end)
if not Success then
warn("Error: "..ErrorMessage)
end
elseif not LogsTable then
local Success,ErrorMessage = pcall(function()
KicklogDatastore:SetAsync(KicklogKey..Player.UserId,LogsTemplate)
end)
if not Success then
warn("Error: "..ErrorMessage)
end
end
elseif not Success then
warn("Error: "..ErrorMessage)
end
Player:Kick("\nClient tried to invoke a RemoteFunction which the client has no access to.\n\n[ These actions have been logged ]")
end
end
I was thinking of fetching the datastore and if the datastore has data that it will insert with table.insert() LogsTemplate
into the datastore, but i have read alot that it would cause datastore errors using table.insert, i don’t know any other way of doing this.