What ever happened to LoadLibrary?

I was going through one of my old GUI dragging and resize scripts, I noticed LoadLibrary was deprecated. Anyone know what replaced it? Or the services replaced the RbxGui, RbxUtility, and RbxStamper

I know LoadLibrary’RbxUtility’.Create was replaced by Instance.new but I’m wondering what ever happened to specifically LoadLibrary, as I could create events and other things we don’t have a library for, or at least that i’m aware of.

LoadLibrary’RbxGui’
LoadLibrary’RbxUtility’
LoadLibrary’RbxStamper’

Lua Doc for LoadLibrary

3 Likes

LoadLibrary is deprecated and not superseded by anything. You are encouraged to write your own libraries if you need utilities for anything via ModuleScripts.

False. Instance.new and RbxUtility.Create have always been separate things. RbxUtility.Create allowed you to specify more parameters to create instances, while Instance.new is reserved to only a ClassName and a parent.

5 Likes

@colbert2677 Can we get a copy of RbxUtility and put it in a module script?

2 Likes

All libraries originally available from LoadLibrary can still be accessed via Roblox’s CoreScripts GitHub repository under the Libraries folder.

RbxUtility’s file is here:

You can fork this by copying the file’s raw contents into a ModuleScript, then requiring that module in your game’s environment. Preferable to have it somewhere in ReplicatedStorage so it’s accessible to both the server and the client, like the original library.

After someone pointed it out, I noticed a large mistake I made. All I can say is im laughing at myself because of it.

LoadLibrary’RbxUtility’.Create used Instance.new; what I was meaning is replacement for .Create{Parent=workspace, Color=bleh, etc=etc}

After a few comments, I just came up with this quickly for a module.

return function(a,b)
local ins = Instance.new(a)
for i,v in next,b do
ins[i] = v
end
return ins
end

module(“Part”,{Parent=workspace, Color=bleh, etc=etc})

1 Like

Uh, don’t do that. You’ll have a performance issue related to the fact that you don’t hold the parent to be set as the last property. RbxUtility.Create handles this automatically actually. Here’s a better version of your function that you can use:

return function(ClassName, Properties) -- Use explicit variable names
    local Parent = Properties.Parent or nil
    local Object = Instance.new(ClassName)

    for Property, Value in pairs(Properties) do
        if not (Property == "Parent") then
            Object[Property] = Value
        end
    end

    Object.Parent = Parent
end

CreateModule("Part", {
    Parent = workspace, -- Automatically set last
    Name = "Something",
})

Obviously doesn’t cover for improper uses. It just assumes you’ll always pass a ClassName and a table to serve as its properties.