What is a LinkedSource and how can I use it?

Hi there,

As the title suggests, I’m having some trouble wrapping my head around what a LinkedSource is. When I looked on the wiki I found this, and while I can kind of understand what it is saying, I’m still struggling to understand how I can use it. Would this help me if I were to try and use OOP (That’s also something I am a bit unsure on aswell, but I suppose that should be for another thread). I couldn’t seem to find anything else to help me understand how to use it, so if I could get a layman’s explanation that would be fantastic!

Any scripts with the same LinkedSource will be exactly the same. They are only really useful if you have multiple copies of the same script and want to edit them all at once - any changes will replicate to all the other scripts.


Ah I see, so it wouldn’t allow me to easily repeat module-scripts that I might have assigned.

Thanks for the help!

It’s also important to realise that if you have multiple copies of the same script - you’re probably doing something wrong. To try and make sure you don’t end up in a situation where you’re having to remove hundreds of scripts, or trawling through the developer console trying to find the source of lag; most things should be controlled by a few central scripts which then, if absolutely required, use BindableEvents or RemoteEvents to make things happen elsewhere, but it’s very rarely a good idea to have multiple copies of the same script in one game before it runs.

also im not saying anyone does this, just that using tonnes of scripts is a bad idea anyway, I think this used to be used a lot for roblox gears?


Yeah I was thinking this seemed a bit wrong, I’m trying to use a single script for the Server and a single script for the client (I think I read that in one of the THEM magazines, however it didn’t really explain how to set that sort of system up).

I’m trying to put most of the functions and scripts I’m using into a module system. I have created a module script called “Essentials”, which is pretty much a compilation of useful functions that I find myself using in other scripts, the issue I find is that I’m often having to call the Essentials Module in many other modules of my game. I was wondering if there would have been a way to easily call the Essentials module without having to require it in the many other module scripts I have.

1 Like

Personally, I don’t really bother with ensuring I have one Server script and one Client script, there is always the concern of efficiency - but then there’s also the need for easy access to your scripts. In most of my games, there are probably around 5 server scripts and 2-3 local scripts, plus another 2-3 for UI animations.

Anyway, I don’t know of a way to solve your requiring problem, the only possible thing I could think of is having a script which uses BindableEvents or BindableFunctions to fire functions within the script, and that script in turn then uses the ‘Essentials’ module itself, therefore meaning the module doesn’t need to be required in every module that uses the it, you can instead call the BindableEvent / BindableFunction which will run the task or return the value.

I’m not sure if this is any more efficient though.

1 Like

Personally I think that probably over complicates things. Really it’s just a single line so it would just be being a bit lazy so instead of writing this at the start of every module;

local Essentials = require(game.ServerStorage.Modules:FindFirstChild("Essentials")

I could just say Essentials and that would automatically know that Essentials means I need to require that module script, But then again it’s not that big of a deal.

Cheers for the help by the way!

1 Like

It sounds like you are just re-creating the way modules already function by making a custom service/singleton pattern with added traffic from the remotes/bindables. You would likely be much better of with the require call since that just returns the same chunk of bytecode without re-compilation.

1 Like

Yeah that’s why I said this, not sure how modules work exactly but if there were hundreds of functions in one would this method not be at all viable? From the word ‘require’ it seems as though the entire module is being loaded into the script for use each time, this is what I assumed was the reason for the OP not wanting to require It in every script

I’d check some sources to give a more informed reply but wiki is being

the wiki


As far as I’m aware the initial require call will produce the bytecode for the module where further calls are simply given a reference to the compiled result instead of re-compiling (your solution doesn’t either, just for clarity as to how it works), as far as traffic is concerned this reference shouldn’t be a performance issue, especially not compared to using bindables with each function call. Perhaps caching the returned function from the bindable would give similar results to require but it sounds a lot like (premature) micro optimization at that point.

1 Like


my web proxy


This. LinkedSources are outdated (unless you have multiple games with the same framework). As an example, imagine a game where you cut trees. Instead of every tree having a copy of the same script, you can have one script in the axe. This becomes more smooth, and easier to edit. Crowded workspaces suck.

1 Like

After hearing the responses I’m not going to be using them, they don’t really suit the purpose I was hoping they were.

For something like a library of utility functions (like your Essentials), you’re doing it the correct way. Lua doesn’t have something equivalent to #include, so requiring your common Essentials library in each module where it’s needed is as good as it gets. That said, you can also make a function accessible everywhere by adding it to the Lua global environment table _G. There is a time and place for everything, but loading up a program with globals is generally bad software design practice.

1 Like