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

4 comments

0

AdminLogs:GetAsync(month) is nil

0

It looks like the key 'month' returns 'nil'. What is the variable 'month'?

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

0

Thank you! That worked.