I don't mean to come off as rude, but you really need to
read your error messages...
I'll give you a rundown, if you don't quite understand them. The first line in any error message will contain [1] the path to the file (and line) that is causing the error, and [2] the error itself.
All subsequent lines will be steps in the stack trace. The stack trace is list of files and line numbers that were executed to get to the line that caused the error.
In your error, the first line is
[ERROR] addons/customcommands/lua/ulx/modules/sh/sh_cc_cafk.lua:8: attempt to index local 'target_ply' (a nil value)This tells us that there was an error on line 8 of addons/customcommands/lua/ulx/modules/sh/sh_cc_cafk.lua. The error was that the Lua engine tried to index a local value that was nil.
If we go to line 8 in addons/customcommands/lua/ulx/modules/sh/sh_cc_cafk.lua, we find this:
ULib.tsayError( target_ply, message )
According to the error, target_ply is nil. This probably means it is undefined, so our next step is to check for a definition of this variable. Go up line by line until you reach the end (technically the start) of the scope (the start of the function or the start of the file if it's not in a function), looking for a definition. Since this is in a function, we should also check the arguments of the function.
local function forceSpec( calling_ply, target_ply )
There it is! Now, target_ply is an argument to the function, so why is it throwing an error? Well, lets investigate further by going down the stack trace.
The second line of the error is this:
1. forceSpec - addons/customcommands/lua/ulx/modules/sh/sh_cc_cafk.lua:8This just tells us that it was executed by the forceSpec function, but we already know that. Onward...
2. unknown - addons/customcommands/lua/ulx/modules/sh/sh_cc_cafk.lua:12This line tells us that forceSpec was called from line 12 of the same file. Looking at that line, we find:
timer.Create( "AFK Timer", 1, 10, forceSpec() )
Okay, so it's a timer that is calling the forceSpec function. I still don't understand what's wrong...
Aha! forceSpec is being called without any arguments. In Lua, functions will still run even if they are not supplied with all their arguments. This means that target_ply will be nil in the function because it isn't being passed. To fix this, you're going to want to add a calling_ply and target_ply argument to your call of forceSpec.
TL;DR: Read your errors, they usually contain useful information. In this case it was a simple case of not supplying the needed arguments.