I am making my own admin command system and at the moment I am having problems with the word seperator.
function admin_command(text)
function findw(msg,var)
spaces = {}
for i = 0, msg:len() do
if msg:sub(i,i) == var
then
table.insert(spaces,#spaces+1,i)
end
end
table.insert(spaces,#spaces+1,msg:len()+1)
sentence = {}
for i = 1, #spaces do
if i > 1
then
table.insert(sentence,#sentence+1,msg:sub(spaces[i-1]+1,spaces[i]-1))
end
if i == 1
then
table.insert(sentence,#sentence+1,msg:sub(0,spaces[i]-1))
end
end
return sentence
end
sentence = findw(text," ")
groups = {""}
for i = 2, #sentence do
if string.find(sentence[i],",") ~= nil
then
names = findw(sentence[i],",")
tab = {}
for i = 1, #names do
table.insert(tab,#tab+1,names[i])
end
table.insert(groups,i-1,{tab,"Group"})
elseif string.find(sentence[i],",") == nil
then
table.insert(groups,i-1,{sentence[i],"Single"})
end
end
end
admin_command(";tp me,chicken gold lol")
Workspace.Script:27: bad argument #1 to 'find' (string expected, got nil) error message
I have no idea what's wrong with it, string.find should work.

4 comments
I have been testing it and for some reason it's removing sentence[3]
Try in the sentence no.3 add spaces{" "},It may help but i dont know.
You must have the problem findw function. Try testing removing and editing and you will eventually fix it a lone.
You guys are worst helpers ever. It's not findw but good job. findw works perfectlly.