Admin System - Module not loading

Hello, I’m trying to insert my module and I’m encountering a problem.

How it’s set-up
image

Loader Script:

local insertService = game:GetService("InsertService")

local assetId = 97312561320814

local success, assetModel = pcall(function()
	return insertService:LoadAsset(assetId)
end)

if success and assetModel then
	assetModel.Parent = game.ServerScriptService["kiCore Version 2"]
end

Error Returned

13:15:08.471 Module code did not return exactly one value - Studio
13:15:08.471 Stack Begin - Studio
13:15:08.472 Script ‘ServerScriptService.kiCore Version 2.Model.MainModule’, Line 36 - Studio
13:15:08.472 Stack End - Studio

Preview

When loaded this is what my place looks like
image

MainModule (script) Code

local serverScriptService = game:GetService("ServerScriptService")
local marketPlaceService = game:GetService("MarketplaceService")
local replicatedStorage = game:GetService("ReplicatedStorage")
local dataStoreService = game:GetService("DataStoreService")
local userInputService = game:GetService("UserInputService")
local teleportService = game:GetService("TeleportService")
local serverStorage = game:GetService("ServerStorage")
local policyService = game:GetService("PolicyService")
local httpService = game:GetService("HttpService")
local textService = game:GetService("TextService")
local testService = game:GetService("TestService")
local playerService = game:GetService("Players")
local teamService = game:GetService("Teams")
local kiCore = require(script.Parent.Parent)
local webhook = require(script.Modules.Webhooking)
local bannedPlayersStore = dataStoreService:GetDataStore("kiCoreBanList")
local tweeningService = game:GetService("TweenService")
local fastTween = TweenInfo.new(0.2, Enum.EasingStyle.Sine, Enum.EasingDirection.Out)

script.Parent = serverScriptService["kiCore Version 2"]

testService:Message("kiCore Version 2: Loading...")

ModuleScript’s have to return something. You can simply add return {} at the end of the module.
If your module is supposed to return something, make sure there is nothing preventing it from doing so.

You was right about this, the module was missing the return function. However, now when I start my game the player added functions do not work or anything… Do you know how to fix this?

Players might be loading before the script is loaded (or inserted), so when connecting PlayerAdded event you should also loop through all players already ingame:

local function onPlayerAdded(player)
    --do stuff
end

for _, player in Players:GetPlayers() do
    onPlayerAdded(player)
end
Players.PlayerAdded:Connect(onPlayerAdded)