Hi. I'm making a small command system, and it's going pretty well. I've stumbled upon an issue where I'm trying to print the number of children in a certain directory. It works well for simple things like workspace, or Lighting, until you get to things like workspace.B_Iu. The script is below:
function Run(ChatService)
ChatService:RegisterProcessCommandsFunction("prt", function(speakerName, message, channel)
if speakerName == "B_Iu" then
if string.sub(message, 1, 5) == ";prtc" then
local dir = string.sub(message, 7)
local val = #game[""..dir..""]:GetChildren()
print("There are currently ".. val .." objects in the ".. dir)
end
end
return false
end)
end
return Run
It returns an error of "DoProcessCommands Function 'prt' failed for reason: workspace.B_Iu is not a valid member of DataModel." Not sure how I can get past this.

1 comment
Thank you!