Should I avoid that due to performance reasons or does that not make a difference at all because it’s the same thing with starter player scripts and stuff?
It doesn’t really hurt performance noticeably. ModuleScripts are super lightweight, they don’t run by sitting in StarterGui; they only run when required by (require(Module))
When you put stuff in StarterGui it clones it to the PlayerGui. If you are really concerned about performance, instead of putting scripts inside your ui’s, put them inside StarterPlayerScripts, and reference your ui’s from there.
An example where putting your scripts in StarterPlayerScripts instead of StarterGui is better, is every single time your player resets, it would have to clone the Ui’s and the scripts into your player gui. I believe it is better practice to only have Ui’s inside player gui and leave StarterPlayerScripts to handle the code for the Ui’s.
Edit:
I believe putting your scripts inside StarterPlayerScript only clones it once. Which is better than leaving your scripts in StarterGui where it has to clone the Ui’s including the scripts every single time.
In this particular situation, all that matters is your preference. Is it convienient for you? If not, then move them somewhere else. If yes, then keep going.
Realistically, worrying about these cases is a waste of time in terms of considering performance. Instead, you could spend your time on things that actually make a noticable difference (like parallel lua, caching exessive work, etc.)
It’s no difference compared to having all the code in the module run in a single localscript/script.
Sure, the initial require() is going to be slower than having the functions and stuff already in the script, but that’s when you join. Who cares if it’s ever so slightly slower then? We care about performance in-game!