Why wont the .OnServerEvent() fire?

I added task.wait()

https://gyazo.com/3035e88ac2d5229a729356b8adffc8c1

It now runs on both now, but the code still does not work

Ok nvm,

I changed the script a little and realized that RunService:IsServer() is running, but not Initiating the modules too. Not sure why…

local RunService = game:GetService("RunService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerSciptService = game:GetService("ServerScriptService")

local Encyclopedia = {}
Encyclopedia.__index = Encyclopedia

local function InitModules(ModuleTable)
	local Success, Error = pcall(function()
		for _, Modules in pairs(ModuleTable) do 
			print(Modules)
			Modules.Init()
		end
	end)
	
	if Error then 
		error(Error)
	end
end

function Encyclopedia.Initiate()
	local self = setmetatable({}, Encyclopedia)
	
	self.Modules = {}

	if RunService:IsServer() then 
		for _, Module in next, ServerSciptService.ServerHandler.Modules:GetDescendants() do
			if Module:IsA("ModuleScript") then 
				print(Module)
				self.Modules[Module.Name] = require(Module)
			end
		end
		
		InitModules(self.Modules)
		
	elseif RunService:IsClient() then 
		
		for _, Module in next, ReplicatedStorage.Modules:GetDescendants() do
			if Module:IsA("ModuleScript") and Module.Name ~= script.Name then 
				print(Module)
				self.Modules[Module.Name] = require(Module)
			end
		end
		
		InitModules(self.Modules)
	end
	
	return self
end

return Encyclopedia

What does the warning message say?

It was just another script that I had, but I got rid of it and it still does not work

If you don’t mind, could you send me a place file with those scripts? It would make it easier to detect the problem.

Game.rbxl (79.3 KB)

I just realized you were searching for the modules inside of the Modules folder located in the ServerHandler, but there is nothing there. You probably were using the Modules folder in the ServerHandler previously, but forgot to use the ReplicatedStorage modules instead.

Encyclopedia
local RunService = game:GetService("RunService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerSciptService = game:GetService("ServerScriptService")

local Encyclopedia = {}
Encyclopedia.__index = Encyclopedia

local function InitModules(ModuleTable)
	local Success, Error = pcall(function()
		for _, Modules in pairs(ModuleTable) do 
			print(Modules, ModuleTable)
			Modules.Init()
		end
	end)
	
	if Error then 
		error(Error)
	end
end

function Encyclopedia.Initiate()
	local self = setmetatable({}, Encyclopedia)
	
	self.Modules = {}

	if RunService:IsServer() then 
		for _, Module in next, ReplicatedStorage.Modules:GetDescendants() do
			if Module:IsA("ModuleScript") and Module.Name ~= script.Name then 
				print(Module)
				self.Modules[Module.Name] = require(Module)
			end
		end
		
		InitModules(self.Modules)
		
	elseif RunService:IsClient() then 
		
		for _, Module in next, ReplicatedStorage.Modules:GetDescendants() do
			if Module:IsA("ModuleScript") and Module.Name ~= script.Name then 
				print(Module)
				self.Modules[Module.Name] = require(Module)
			end
		end
		
		InitModules(self.Modules)
	end
	
	return self
end

return Encyclopedia

There were a few errors in the output after I tested it out, but I could fix them.

Game.rbxl (80.2 KB)

There was an error in the MorphService because I don’t have Shirts or Pants on my character. I’ve made the MorphService automatically create them though (if doesn’t already exist).

Edit: I’ve tested the game. The morph seems to work pretty well.

Bruh, after all of that, I just forgot about the folder in ServerHandler…

Thank you for your help! It was much appreciated.