How do I reference my modules!?

Hello. I am thinking of some sort of way to structure all of the references to my modules. These would be found in each script. Though they would take up some space, I think it might be the best to work with for me. Does anybody have any insight or feedback regarding this style of module referencing?

local tree = {
	server_modules = run_service:IsServer() and {
	
	},
	
	shared_modules = {
		classes = {
			remote_connection = require(replicated_storage.framework_shared.classes.entity.remote_connection)
		}
	},
	
	client_modules = run_service:IsClient() and {
		
	}
}
1 Like

Structure your script hierarchy in a way so that each script has only the dependencies it needs. There is no reason to have every module available to every script. Have each module necessary initialized by its parent module, then access it through the parent :hugs:

6 Likes

Like what @goot said, you shouldn’t do this.

Also in my opinion you should only have client and server modules, with the server being able to access the client ones if necessary. The server should never be denied access to anything in your experience.

3 Likes

Thank you for your comment, but I’m more asking about whether or not this is an okay way to structure my variables when it comes to accessing the framework.