Having a bit of trouble understanding module script

i think im being stupid

so basically im wondering why print doesnt work on module script

when i write a simple print in the module
it doesnt error and it doesnt do anything

when i do this

--module
local animator, animation = script.Parent.Humanoid.Animator, script:WaitForChild("Animation")

local module = {}

for i, v in pairs{
	"rbxassetid://7659151023";
	"rbxassetid://7658585904";
	} do animation.AnimationId = v
	
	local animationtrack = animator:LoadAnimation(animation)
	table.insert(module, animationtrack)	
end

return module

--script
wait()
local module = require(script.Parent)
local a1, a2 = unpack(module)

print(a1,a2)

i dont really understand why it happens
to me i should be able to do both

I believe this is just because you’re not using parentheses on your for loop, thus your module is breaking and not getting to the print.

It also could be your WaitForChild not being able to find the Animation object within the Module.

Did you mean to look in the animator instead?

--module
local animator =script.Parent.Humanoid.Animator
local animation = animator:WaitForChild("Animation")

local module = {}
local data = {
	"rbxassetid://7659151023";
	"rbxassetid://7658585904";
}
for i, v in pairs (data) do animation.AnimationId = v
	
	local animationtrack = animator:LoadAnimation(animation)
	table.insert(module, animationtrack)	
end

return module

i think theres a misunderstanding

i did this

local module = {}
print("ok")
return module

roblox lets me put “{}” instead of “()” in the for loop and it will work
besides it looks cleaner so yeah

i learned from the for loop that module scripts can run some normal code that you would normally be able to on a script

but im not too sure about the rules involving it
but it just can run some normal code

nevermind i was actually being stupid

requiring the module made all the difference

requiring the module runs all the code inside the module as well

weird but okay