Module code did not return exactly one value

Hey guys, today while reorganizing my game I decided to implement a module loader I had found awhile ago, but am having trouble getting it to work. Currently, the way I intend for it to work is to loop through two folders which contain nested module scripts, and run the defined functions inside. But I’m only receiving this error message, Module code did not return exactly one value instead. Is it possibly due to the number of module scripts it would have to comb through, or is there another way to get require to work on an table containing module scripts? Below will be pasted the current code I’m using. Any help figuring this out will be greatly appreciated! <3

-- Services
local RunService = game:GetService("RunService")

-- Functions
function Loader.LoadAll()
	-- Get ReplicatedStorage scripts
	local ReplicatedStorage = game:GetService("ReplicatedStorage")
	local Shared = ReplicatedStorage.Shared
	local RSScripts = Shared:WaitForChild("Scripts")

	local serverOrLocalScripts = nil

	-- Get if server or local
	if RunService:IsServer() then
		local ServerScriptService = game:GetService("ServerScriptService")
		local server = ServerScriptService.Server
		local SSSScripts = server:WaitForChild("Scripts")
		serverOrLocalScripts = SSSScripts
	elseif RunService:IsClient() then
		return
	end

	-- Initialize ReplicatedStorage modules
	for i, moduleScript in pairs(RSScripts:GetDescendants()) do
		if moduleScript:IsA("ModuleScript") then
			moduleScript = require(moduleScript)
			if moduleScript["Init"] then
				moduleScript.Init()
			end
		end
	end

	-- Start ReplicatedStorage modules
	for i, moduleScript in pairs(RSScripts:GetDescendants()) do
		if moduleScript:IsA("ModuleScript") then
			moduleScript = require(moduleScript)
			if moduleScript["Start"] then
				moduleScript.Start()
			end
		end
	end

	-- Initialize server or local modules
	for i, moduleScript in pairs(serverOrLocalScripts:GetDescendants()) do
		if moduleScript:IsA("ModuleScript") then
			moduleScript = require(moduleScript)
			if moduleScript["Init"] then
				moduleScript.Init()
			end
		end
	end

	-- Start server or local specific modules
	for i, moduleScript in pairs(unpackserverOrLocalScripts:GetDescendants()) do
		if moduleScript:IsA("ModuleScript") then
			moduleScript = require(moduleScript)
			if moduleScript["Start"] then
				moduleScript.Start()
			end
		end
	end
end

return Loader
local PlayerMovementService = {}

function PlayerMovementService.Init()
	print("Init")
end

function PlayerMovementService.Start()
	print("Start")
end

return PlayerMovementService

The first code snippet returns Loader but I don’t see Loader defined anywhere. Did you forget the line:

local Loader = {}

Typically, a ModuleScript defines a table like this and returns it.

I don’t know why it got cut off but I did include the first line in Loader, as well as the return at the bottom. Below is the full script

local Loader = {}
-- Services
local RunService = game:GetService("RunService")

-- Functions
function Loader.LoadAll()
	-- Get ReplicatedStorage scripts
	local ReplicatedStorage = game:GetService("ReplicatedStorage")
	local Shared = ReplicatedStorage.Shared
	local RSScripts = Shared:WaitForChild("Scripts")

	local serverOrLocalScripts = nil

	-- Get if server or local
	if RunService:IsServer() then
		local ServerScriptService = game:GetService("ServerScriptService")
		local server = ServerScriptService.Server
		local SSSScripts = server:WaitForChild("Scripts")
		serverOrLocalScripts = SSSScripts
	elseif RunService:IsClient() then
		return
	end

	-- Initialize ReplicatedStorage modules
	for i, moduleScript in pairs(RSScripts:GetDescendants()) do
		if moduleScript:IsA("ModuleScript") then
			moduleScript = require(moduleScript)
			if moduleScript["Init"] then
				moduleScript.Init()
			end
		end
	end

	-- Start ReplicatedStorage modules
	for i, moduleScript in pairs(RSScripts:GetDescendants()) do
		if moduleScript:IsA("ModuleScript") then
			moduleScript = require(moduleScript)
			if moduleScript["Start"] then
				moduleScript.Start()
			end
		end
	end

	-- Initialize server or local modules
	for i, moduleScript in pairs(serverOrLocalScripts:GetDescendants()) do
		if moduleScript:IsA("ModuleScript") then
			moduleScript = require(moduleScript)
			if moduleScript["Init"] then
				moduleScript.Init()
			end
		end
	end

	-- Start server or local specific modules
	for i, moduleScript in pairs(serverOrLocalScripts:GetDescendants()) do
		if moduleScript:IsA("ModuleScript") then
			moduleScript = require(moduleScript)
			if moduleScript["Start"] then
				moduleScript.Start()
			end
		end
	end
end

return Loader

Looked in my other module scripts, turns out I missed the table line in them. Thanks for pointing out my mistake xD