Allow us to require LinkedSource modules by name

As a Roblox developer, it is currently a pain in the [ Content Deleted ] to traverse the DataModel to reach the ModuleScript libraries that we use frequently. When we’re in a networked game, we can’t guarantee the objects will immediately be there, so we usually have to go through WaitForChild chains in every single script that we want to use a library in.

This results in a lot of redundant code having to be typed, and if we move anything around, we have to go back and adjust the code to correctly reference the libraries we’re looking for, and ultimately makes me hate having to write code in Lua with a burning passion.

So this got me thinking, if we have the LinkedSource feature in universes, why can’t we just add our library code into there, and then load it in remotely by it’s name, via require?

How it would work in practice:

image

Roblox’s old LoadLibrary function is a FANTASTIC example of how something like this makes things so much less painful in Roblox development.

If you wanted to use Roblox’s RbxGui library, all you had to do was:

local RbxGui = LoadLibrary("RbxGui") -- BOOM! There it is.

And that was it. Really! No hierarchy traversal, no WaitForChild chains on the client, it was really that easy.

I want advanced game development on Roblox to be this easy and streamlined for libraries I use, without having to worry about the ugly quirks of Roblox’s DataModel and network replication.

41 Likes

I support honestly, i’m having that kind of problems too.

1 Like

Agreed x100. I personally find it annoying to load modules or anything that you have to require, and using a :WaitForChild() can result in a small delay, mean slower loading time for players and such. Along with that, it’s just a big pain as a developer to have to constantly do that if it can be pre-loaded or such.

I wouldn’t be opposed to just taking any string argument to require() and trying to find it in the datamodel complete with WaitForChild when called on the client.

3 Likes

A post was merged into an existing topic: Memes, Puns & Meme related GIFs Thread

I support this 110%! The project my team and I currently working on would benefit greatly from this.

Support.

I kinda wish ROBLOX had some “ready” functionality like Godot Engine does. It’s really annoying having to use WaitForChild for everything.

2 Likes

This along with standard notation for traversing directories on the filesystem would be preferred. I.e. ./ references script.Parent and ../ references script.Parent.Parent.

require("./Module") -- script.Parent.Module
require("../Module") -- script.Parent.Parent.Module
1 Like

We built a similar system for the egg hunt:

local Spring = shared.include'/lib/math/Spring'
local Maid   = shared.include'/lib/util/Maid'
local Camera = shared.include'/core/Camera.client'

But after dealing with the experience of editing 16 places whenever I wanted to add a new module to our library, I don’t even want to deal with keeping an in-game copy of those modules.

I want to be able to store, organize, and require large chunks of my codebase in the game explorer without the need to mirror it in the datamodel.

4 Likes

Having a global repository to pull from for all places in your game would be wonderful. I don’t have a use for that but I can see how helpful it’d be.

I work exclusively outside of Studio for programming, and I’m personally rooting for a solution that allows all of the code for your game to be exported to the filesystem and synced into your game. A directory structure like this could be nice:

GameName/
  Scripts/ (Accessible by all places)
    Helpers/  
  Place1Name
    ReplicatedStorage/
    ServerScriptService/
  Place2Name/
  etc...

I don’t know how this could be synced with the published game though, especially with stuff like Team Create being around.

4 Likes

I support. I think that something like that would make the linkedsourced scripts really really bettter.
I hope roblox will notice this great idea. Can’t wait for this feature. I would surely use it in my future projects.
Thanks for thinking about that.

https://devforum.roblox.com/t/gamestorage-service/40076