[Module Script] Direct Require or back to Handler and Require

Hi I’m doing a Framework to my Game and I have a doubt.

My ServerHandler: Start All Modules (NPC, DataHandler, NPCData, PlayerData)

And I’m thinking about,
I do: [Npc] module require(ServerHandler) to require(NpcData)?
Or just [Npc] require [NpcData]?

So what I’m trying to say is.

Which of them is better:
(Direct Way or ServerHandler To Module Way)
[NPC] > [ServerHandler] > [NPCData]
or
[NPC] > [NPCData]

(Sorry if sentence is weird, I’m studying english at moment.)

I simply have one script that requires all my modules which I store in serverstorage.

I have two types of modules. Runtime modules and just regular Modules. There is a difference here. Runtime Modules is what that one script requires. When the script is run it simply requires every module in a Runtime folder.

The other modules folder is the folder I use when I need to require modules in a specific order, it’s also a place used to store modules in progress. Basically, I have a couple of scripts. One is called Debug, another is called Helper and then you have DataHandler.

All of my other modules still require them manually. But they all start automatically as long as they’re in the runtime folder.

For my NPCService there isn’t really another module. It creates and keep track of all NPCs. So there’s no need for an extra module to require the NPCService module.

What exactly does your ServerHandler do?

Basically has access to every module.

I’d recommend just getting the NPCData directly from NPC. Since you don’t want to require things you don’t need. But if you think you’ll need them then you should go through ServerHandler.

1 Like

Ok.
Thanks, is good to has a Veteran helping others.

1 Like