Trying to make a task system, it's supposed to get a random task from a table and require it, but it doesn't. Task keeps returning as "None"
local tasks = {
"DigitsOfPi",
"Jump",
"ZeroHealth"
}
script.Parent.Triggered:Connect(function(player)
print("triggered")
if player.Task.Value == "None" then -- a string value
local taskLabel = player:WaitForChild("Task")
local task = tasks[math.random(1,#tasks)] -- gets name of task
local assignedTask = require(script[task]) -- requires task
print("random") -- printing stops here, so i am guessing that it does not require
if assignedTask.Name == "DigitsOfPi" then
print("digits of pi")
taskLabel.Value = "Chat 200 digits of pi"
assignedTask.Task(player,100)
elseif assignedTask.Name == "Jump" then
print("jump")
taskLabel.Value = "Jump 100 times"
assignedTask.Task(player,500)
elseif assignedTask.Name == "ZeroHealth" then
print("die lol") -- dont mind this
taskLabel.Value = "Reach 0 health"
assignedTask.Task(player,1000)
end
end
end)
I've tried using script.DigitsOfPi etc etc, but it still won't work. Is there something I am doing wrong? Thanks in advance

4 comments
Unless you have a 'Name' attribute in the Table you're returning from the ModuleScript, then your conditionals referring to it are going to fail; require inherits the Table, not the Script.
I am confused
Im not requiring the table, Im requiring the script...it gets the random name, and I am no longer using the table after that?
OH WAIT I FIGURED IT OUT. THANK YOU. I WAS HAVING TROUBLE WITH WHAT YOU SAID AND THEN IT CAME TO ME. Youre right, It is accessing the table in the module script, not the actual modulescript......THANK U