Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Logging system giving me "table index is nil" error?

Hi, I've been trying to make a logging system for exploiters, but I'm getting this error: ServerScriptService.Log:6: table index is nil This is (part) of my script:

local cache = {}
local flagged = {}

function log(plr,log)
	if not cache[plr.Name] then
		cache[plr.Name] = true
		game.HttpService:PostAsync(hook,game.HttpService:JSONEncode({["content"] = log}))
		if not flagged[plr.Name] then
			flagged[plr.Name] = 0
		end
		flagged[plr.Name] = flagged[plr.Name] + 1
		if flagged[plr.Name] == 3 then
			plr:Kick("Flagged\n\nReport To Devs With Code 35")
		end
		delay(4,function()
			cache[plr.Name] = false
		end)
	end
end

8 comments

0

what line is the error on?

0

Line 6\

0

Is line 6 on the entire script, line 6 on the snippet of the script you sent? I don't see anything wrong with line 6 here

0

same. That's why I posted it on this site. The error is on line 6. You can tell by the ":6:" in the error code

0

wait... im dumb

0

Yeah, I know that. I just wanted to make sure because you said this is part of the script, so line 6 in the snippet you sent could be line 23 for example in the entire script. Anyway can you add the snippet of when the log function is ran? This error means plr.Name is nil

0

Lol I didn't mean to say I know you're dumb that was terrible timing lmao

0

it's fine. I made sure to make the error message on the right thing

1 answer

so, i forgot to send the player through the event and it was only sending the log message.

This discussion is preserved as it was. New answers, comments, and votes are closed.