local comMod= script.Parent:WaitForChild('ModuleScript');
local background = comMod.WaitForChild(script.Parent, 'background');
local main = comMod.WaitForChild(script.Parent.Parent, 'Main');
local questButton = comMod.WaitForChild(background, 'quests');
local questFrame = comMod.WaitForChild(main, 'questFrame');
local challengeFolder = comMod.WaitForChild(main, 'Challenges');
local challenges = {};
---// variables am i rite
function insertChallenge(challenge)
print('adding '..challenge..' to the Challenges Table!');
local amount = #challenges
table.insert(challenges, (amount+1), challenge)
print(challenges[amount+1]);
return challenges[amount+1];
end
function removeChallenge(number)
table.remove(challenges, number)
return true;
end
function updateChallenges()
for i = 1,#challengeFolder:GetChildren() do
wait();
local name = challengeFolder:GetChildren()[i].Name
print(challenges[i]);
if challenges[i] == name then
print(name..' is already in the Challenge Table!');
return true;
elseif challenges[i] ~= name then
print(name..' does not exist in the Challenge Table, adding it now!');
insertChallenge(name);
return challenges.name;
end
end
end
questButton.MouseButton1Click:connect(function()
script.Disabled = true;
updateChallenges();
questFrame.Visible = not questFrame.Visible
script.Disabled = false;
end)
So, for some reason in the 3rd function, updateChallenges(), whenver I check to see if the challenge is already in the table, it will not read it and say it is not in the table?

4 comments
you need to use require to access functions inside ModuleScripts; local comMod = require(script.Parent.ModuleScript)
But when I do that, it errors out the whole script, when I don't it works fine up til that point?
show us the module script
Nevermind, it's because I put the module function as, module.WaitForChild(function() instead of module.WaitForChild = function(), but it still won't read the table correctly.