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.):