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

bad argument #1 to 'insert' (table expected, got nil)?

Asked by 4 years ago

Hello, I'm Making a JoJo game and I made an admin logs thingy so when an admin writes a command in chat it writes it in the logs. But I get an error: 19:39:39.867 - ServerScriptService.MainHandler:1306: bad argument #1 to 'insert' (table expected, got nil).

Script (Server):

if commandused then
    local logs = AdminLogs:GetAsync(month)

    table.insert(logs, player.Name..commandused)
    AdminLogs:SetAsync(month, logs)
end

Help Would Be Really Appreciated

0
AdminLogs:GetAsync(month) is nil theking48989987 2147 — 4y
0
It looks like the key 'month' returns 'nil'. What is the variable 'month'? xChris_vC 5 — 4y
0
You'd want to do AdminLogs:GetAsync(month) or {}; sometimes DataStores might not return the data or it doesn't have any data at all Rare_tendo 3000 — 4y
0
Thank you! That worked. MajinBluee 80 — 4y

Answer this question