Module freezing/not doing anything after requiring another module

I need help on this.
I don’t think I can fix this myself, so I am going on the forum.
Issue: Module freezing/not doing anything after requiring another module.

Heres the plot:
One script is listening for when the player chats, and when they use the prefix |, it will require the parse with the message and player, and then after parsing the message i.e getting the arguements, it will require the module that will do the commands.

What it is not doing:
It is not requiring the module that will do the commands, like it’s freezing or not doing it at all.

How do I know that it is actually requiring it and if it’s not?
I used print.
After putting the print below the code that requires the module that does the commands, it does not print at all.
That is how I know.

I added a command simply called print.
It’s not printing anything.

Parse Code:

local module = {}
function module:ParseMessage(player,message)
	local Li = require(script.Parent.Lists)
	local mo = require(script.Parent)
	local Message = string.lower(message)
	local prefix = mo:GetPrefix()
	local prefixmatch = string.match(Message,'^'..prefix)
	if prefixmatch then
		Message = string.gsub(Message,prefixmatch,"",1)
		local Arguements = {}
		for Arguement in string.gmatch(Message,'[^%s]+') do
			table.insert(Arguements,Arguement)
		end
		local CommandName = Arguements[1]
		table.remove(Arguements,1)
		for _,_arg in pairs(Arguements) do
			Li:DoCommand(CommandName,player,_arg)
		end
	end
end
return module

My list that is doing the commands code(I only took the function out of the module for security purposes.):

function module:DoCommand(cmd,whodidit,target)
	for i,v in pairs(Commands) do
		if string.match(string.lower(i),cmd) then
			for _a,_va in pairs(Enhancer) do
				if string.match(string.lower(_a),cmd) then
					local b = ZXMCZZXI:IsPlayerAboveRequired(whodidit,Commands[i][2])
					if b == true then
						Enhancer[_a](whodidit,target)
					else
						--///Nothing.
					end
				end
			end
		end
	end
end

Comparisons:
When it doesn’t have the require line in it(I made it so that the parse prints the arguements.):


When it does(I left the print in there.):

Hi, I am unaware if you are still having this issue, but for anyone else that comes across this post…

If you have this same issue, go to the module you are requiring and check for any while loops, for loops, or waits that could potentially be delaying the end of the script.

For example if this is my module that I decided to require

local module = {}

while true do
    wait(1)
end

return module

My module would never finish requiring, thus the script seems to have “frozen”.


If your looking for a workaround because that while loop/wait/etc.is necessary, then check out coroutine’s or spawn’s.