LoadLibrary is going to be removed on February 3rd

UPDATE This update is live as of February 3rd, 2020.

UPDATE This has been postponed once more to February 3rd.

UPDATE This has been postponed to January 6th; the post has been updated with the new timeline.

What’s going on?

LoadLibrary is a legacy mechanism that we previously used to provide access to Roblox-maintained Lua code. However, we haven’t updated the list of libraries or the libraries themselves in ages. There are three libraries: RbxGui, RbxStamper and RbxUtility; the first two are almost never used, the last one is occasionally used by some games for helpers like RbxUtility.Create.

LoadLibrary has been challenging for us to support due to mechanics of how Lua library loading works on the client. Because of this, we have inadvertently broken this mechanism a few times, and it prevents development of some internal changes.

Additionally, Studio has been warning about LoadLibrary deprecation for several years now (via Script Analysis widget).

Given all of the above - it’s a rarely used mechanism that is expensive for us to maintain that has been deprecated for a while and easy to stop using - we have decided to remove this function entirely.

Removal timeline

Because LoadLibrary has been deprecated for years we feel that we can move relatively quickly, but we want to make the transition away from this functionality as painless as possible. So the removal is going to come in three stages:

  • November 13th 2019: any use of LoadLibrary will produce a warning in the output window. The function will continue working as before.
  • February 3rd 2020: any use of LoadLibrary will start failing.

This schedule will give a bit more time for the community to transition plugins and server-side code away from LoadLibrary.

How do I know if my code is affected?

The easiest way to tell is to search for LoadLibrary (case sensitive) in all your scripts. Note that Script Analysis tab will contain a warning for every use of LoadLibrary - we recommend keeping your code clean of deprecation warnings in particular, as functions are deprecated for a reason.

After November 13th you will be able to run your game in Studio or live and check if output contains any warnings, but we recommend proactively removing LoadLibrary instead of waiting - this will make sure you don’t use it even in rarely executed parts of your code

I use LoadLibrary, what do I replace it with?

We recognize that you don’t really want to spend a lot of time cleaning up uses of LoadLibrary. Usually the use of LoadLibrary is just for RbxUtility.Create which is a simple enough function to replicate, but some of you may be using RbxStamper or RbxGui. The good news is that it’s easy to replace LoadLibrary with the use of ModuleScripts and require. Here’s how to do this:

  1. Download the attached file that contains 3 ModuleScripts in a Folder:

LoadLibrary.rbxmx (249.0 KB)

  1. Insert it into your game into ReplicatedStorage by right clicking ReplicatedStorage, choosing “Insert from File…” and locating the file you downloaded.

  2. In your script code, replace LoadLibrary calls with require as follows:

local RbxUtility = require(game:GetService("ReplicatedStorage"):
    WaitForChild("LoadLibrary"):WaitForChild("RbxUtility"))

-- call RbxUtility.Create as usual

Of course you are free to put the libraries into any other location in your game’s hierarchy, and you can remove RbxStamper / RbxGui if you only need RbxUtility.

That’s it! That’s all it takes.

Please be proactive about changing this so that the actual removal of this functionality doesn’t take you or your game by surprise.

Fun fact: this post contains 20 mentions of the word LoadLibrary.
225 Likes

Phew! Had me worried there for a minute. I know a really old plugin I made (that I still use sometimes) uses RbxGui so I’m glad there will still be a supplemental way to use it.

27 Likes

Any particular reason why you’re causing the client to fail first? I’m curious.

16 Likes

Probably because the whole reason they’re removing it seems to stem from difficulties with maintaining it on the client:

LoadLibrary has been challenging for us to support due to mechanics of how Lua library loading works on the client

10 Likes

If LoadLibrary is going away in January 2 then the major of gears will be broken which made by luckymaxer with scripts.

Are you planning to update half of the gears where it used LoadLibrary?
For example:
The gear called Throwing Lunchbox (2385192846) and is still using LoadLibrary

32 Likes

There honestly isn’t that much need to update gear. The only games that actively do use raw gear are those which allow gear types in their games and that’s normally for very old games. Gear now is just for aesthetic purposes and such is also available in games under developer control (e.g. buy flashlight for X coins).

14 Likes

Unfortunately, scripts in these gear items will break. I wouldn’t expect any popular game on Roblox to accept arbitrary gear or any gear at all really without removing all scripts from the items. It’s just too dangerous and unpredictable.

17 Likes

LAMO RIP all the gear that I worked on in 2013. IIRC a lot of them use it. Also:

Nobody:
Stravant: invents create function
Zeuxcg: internal screaming

86 Likes

No way, they should try placing the module in the game itself when it loads and then if the function is called in, it should automatically return the function so that way the games won’t break

6 Likes

Ah jeez. I think I need to go update code from half a decade ago now.

I’d be interested to know if anyone is actually using RbxStamper for anything… I’ve never actually seen it used, and it’s looking like I won’t ever.

8 Likes

A lot of opensourced scripts and models, use LoadLibrary. Although they will break in due course, I am very happy you provided a solution to fixing this problem, with the 3 modulescripts you allowed us to download.

If it were me, I might make the function throw an error that links a solution to fixing it, to a forum like here.

5 Likes

Our warning is in fact going to link to this post :slight_smile:

19 Likes

I never used seen, or heard of this “LoadLibrary” in any user made scripts… but i read above that its used in gear, so i hope the gear gets repaired, i already have enough wasted robux invested on broken gear as it is :confused: But i guess If it improves roblox and saves time and money while making new updates, then ill be happy to see it go.

4 Likes

I’ve seen loadlibrary in one script. Probably F3X’s modules. I never really got to use 'em!

3 Likes

Thing is, even though its rare, i still allow some gear items in my games, not deadly or destructive items, like social items or musical, it allows people to enjoy the game along with there own items and experience the game in a personal way. I do know of a few other games that do the same, so ill be a bit sad to see any of these gears get destroyed and never repaired, my games will loose a little something…

9 Likes

This is an extremely niche case and not significant enough to justify focusing on repairing gear, unless there’s someone in the office who just has that much time or drive to do that.

Most of the aforementioned items (social and musical gears) are commonly recreated by the developers and made publicly available through some means of gaining it or sold as either developer products, game passes or purchasables with in-game currency. Sometimes, these custom made gears or edits to existing gears work better than current ones.

A large portion of games that do allow owned gear are commonly legacy games which aren’t supported any longer in the same way gears are legacy (or if they aren’t, I assume they will be eventually).

2 Likes

dues this mean its planned just to abandon gear all together?

4 Likes

I strongly doubt that gear will be discontinued, but it probably won’t be completely supported either. I’m mostly speaking from what I know as well as what’s been seen in and around the platform. There are very few remaining games that still use raw gear from the catalog. Most games custom make their own gear or only use certain pieces of gear (e.g. their meshes).

In the case that you do see catalog gears being used in games, they are often heavily modified versions tailored for the game (such as changing values, making it work with game systems, fixing it, so on). An example could be Epic Minigames. The game does use catalog gear but it looks to be sandboxed to fit game systems. I have no way to prove this as I’m not a developer but the suggestion of that being the case is very strong.

What I am mainly trying to say is that it’s unlikely that gears will be repaired or updated without probable cause for doing so (like with any other case of accepting feature requests and turning them into actual features). As it is, most gear is incompatible with R15, hence lack of updates.

7 Likes

Its not even what you mean by ROBLOX Gear, from the catalog. “LoadLibrary” is a broad term to what the functions were actually like.

function weldObject(x, y)
    local cf = CFrame.new(x.Position)
    local c0 = x.CFrame:toObjectSpace(cf)
    local c1 = y.CFrame:toObjectSpace(cf)
    assert(LoadLibrary("RbxUtility")).Create("Weld"){
        Part0 = x,
        Part1 = y,
        C0 = c0,
        C1 = c1,
        Parent = x,
    }
end

function combineParts(object)
    if script.Parent:FindFirstChild("Handle") then
        if object:IsA("BasePart") then
            weldObject(script.Parent.Handle, object)
            object.Anchored = false
        else
            table.foreach(object:GetChildren(), function(i, c)
                combineParts(c)
            end)
        end
    end
end

combineParts(script.Parent)

This is just an example of a freemodel welding script that puts parts together in a tool when there aren’t any welds, which is usually found in all types of gear. LoadLibrary like used in this, has widely been used within free models for over the past half decade.

From what I’ve seen, LoadLibrary has been used in leaderboards, admins, music players, gun systems, sound bars, dubstep guns, of course gear, and more…

Although.

@mkhamster gave a very practical solution which ensures that scripts won’t break using the LoadLibrary functions.

I think maybe automatically loading the modules into a client limited service like ReplicatedStorage, would be a good address point that the LoadLibrary functions could redirect to.

8 Likes

When i downloaded LoadLibrary.rbxmx it doesn’t let me open it and shows as blank icon, i tried to open it on roblox studio, it didn’t show and doesn’t let me, it only said that there is no type of program like this .rbxmx and what is the issue i despertly needed the modulescripts but i unable to get it, without loadlibrary npcs wouldn’t work as attempt to call string value. :frowning:
If you could share me supported place loadlibrary i would appreciate your help.

3 Likes