Sorry I really couldn't think of a better title for this error. So the problem I'm having is the table, the script is supposed to return 2 members but it's saying the 2nd member is nil? It found the first one but not the second.
Image: https://i.imgur.com/zrGPG5C.png
The error has to be in this function (at no point does the forcefield function set the 2nd member nil):
function RunCommand(Str)
CMD = nil
Func = nil
ArgsReq = nil
Args = {}
-- Get Command and other ****--
Find = string.find(Str, " " )
CMD = string.sub(Str, 1, (Find - 1))
ArgsReq = Commands[CMD].ArgsReq
-- Get Args --
if ArgsReq > 0 then
for i = 1, ArgsReq do
Arg = nil
Find2 = string.find(Str, " ")
Str = string.sub(Str, (Find2 + 1))
Find3 = string.find(Str, " ")
if Find3 then
Arg = string.sub(Str, 1, (Find3 - 1))
else
Arg = Str
end
table.insert(Args, Arg)
end
if ArgsReq > 1 then
for i = 1, #Args do
print(tostring(Args[i]))
end
Commands[CMD]:Func(Args)
elseif ArgsReq == 1 then
Commands[CMD]:Func(Args[1])
end
else
spawn(Commands[CMD].Func()) -- Ignore this it doesn't get called.
end
end

7 comments
local variables please
I don't understand that the CMD variable is supposed to be set to be.
Also, string.find returns 2 values, one is the start of the word and one is the end.
@hiimgoodpack, 1) Can't use local variables I reached the max limit. 2) CMD variable is used to get the function data out of a table. Basically creating a universal admin commands if someone ever wanted to add their own commands they can very easily with this function. 3) No. string.find is returning 1 value which is why it printed 2 arguments in the console. See the image link for more info
Max limit for local variables?
"string.find[edit] string.find (s, pattern [, init = 1 [, plain = false]]) Looks for the first match of pattern in string s. If a match is found, then string.find returns the locations (1, 3, etc.) of s where this occurrence starts and ends; otherwise, it returns nil." Yes it does return 2 values.
Can you give us an example of what would be passed as the str?