Attempted to call require with invalid argument(s)

Hello I keep getting this error i’m not sure why let me know if there is something wrong with the require line.

function Shack:getJob(job)
	
	local newJob = getJobName(job)
	print(newJob)
	local JobModule = require(componentFolder:FindFirstChild(newJob))
	local jobNew = JobModule.New(self)
	
	jobNew:Init()
end

try tonumber(newJob)

I am assuming this “newJob” is supposed to be a number

like tonumber(componentFolder:FindFirstChild(newJob))

1 Like

newJob is a string btw sorry for not mentioning that

is it a possibility that componentFolder:FindFirstChild(newJob) is returning nil?

I did a print line and it prints what I want it to print, what is printed is the module name also

See if changing

componentFolder:FindFirstChild(newJob)

too

componentFolder:WaitForChild(newJob)

and see if anything changes or errors

1 Like

Are there any other objects sharing the name of the module? If you have for example fireball ModuleScript and fireball Part in the same folder, you need to rename one.

1 Like