attempt to index a nil value (field ‘?’) on FiveM essentialmode

i have problem in one part of the code, i´m not coder, i looked over on the internet but i didnt find anything that would help, the problem is on line 234 which is if groups[Users[source].getGroup()]:canTarget(group) then idk what to do, this is the error

Error running call reference function for resource essentialmode: citizen:/scripting/lua/scheduler.lua:351: server/main.lua:234: attempt to index a nil value (field '?') stack traceback: server/main.lua:234: in upvalue 'ref' citizen:/scripting/lua/scheduler.lua:337: in function citizen:/scripting/lua/scheduler.lua:336 [C]: in function 'xpcall' citizen:/scripting/lua/scheduler.lua:336: in function citizen:/scripcfx ting/lua/scheduler.lua:335> stack traceback: [C]: in function 'error' citizen:/scripting/lua/scheduler.lua:351: in function citizen:/scripting/lua/scheduler.lua:322

function addGroupCommand(command, group, callback, callbackfailed, suggestion)
commands[command] = {}
commands[command].perm = math.maxinteger
commands[command].group = group
commands[command].cmd = callback
commands[command].callbackfailed = callbackfailed

if suggestion then
    if not suggestion.params or not type(suggestion.params) == "table" then suggestion.params = {} end
    if not or not type( == "string" then = "" end

    commandSuggestions[command] = suggestion

ExecuteCommand('add_ace group.' .. group .. ' command.' .. command .. ' allow')

RegisterCommand(command, function(source, args)
    if groups[Users[source].getGroup()]:canTarget(group) then
        callback(source, args, Users[source])
        callbackfailed(source, args, Users[source])

debugMsg("Group command added: " .. command .. ", requires group: " .. group)          end

Read more here:

Content Attribution

This content was originally published by Denis Neznámy Uhrík at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: