LoadLibrary not working?

So with the whole loadlibrary being removed thing, how would I go about fixing this? Its just a little part of the script but I am stumped how to fix it?

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

Create = RbxUtility.Create
1 Like

the code itself is available

1 Like

Is LoadLibrary directly inside ReplicatedStorage along with RbxUtility inside it?

This function you’re trying to use is simple to re-create and optimise anywho:

local function create(className, properties)
    local new = Instance.new(className)
    for property, value in pairs(properties) do
        if not property == "Parent" then
            new[property] = value
        end
    end
    new.Parent = properties.Parent 
    --// Parent it lastly, otherwise roblox would need to handle replication jobs etc 
    --// If properties.Parent is nil then it'll stay in nil anyways
    return new
end

Did you mean to do not (property == "Parent")?
property ~= "Parent" also works

1 Like

Im really confused, I don’t really understand the whole loadlibrary thing, let alone what it does.

LoadLibrary has actually been depreciated for a very long time now, and roblox is talking about wanting to remove it soon, here is an article:

edit: I would try not to bother using it, but other developers might have some things for in mind.

Think of it as a primitive ModuleScript that was global and full of mostly awful made functions.

For a more accurate recreation of Create, which I still wouldn’t recommend, use this.

local next = next

local function Make(InstanceType)
	local function ClosureFunction(Table, ...)
		local Object = Instance.new(InstanceType)
		local Parent = Table.Parent

		if Parent then
			Table.Parent = nil
		end

		for Property, Value in next, Table do
			if type(Property) == "number" then
				Value.Parent = Object
			else
				Object[Property] = Value
			end
		end

		if Parent then
			Object.Parent = Parent
		end

		if ... then
			local Length = select("#", ...)
			local Objects = {...}

			--for a = 1, Length do
			for a, OtherObject in next, Objects do
				local Object = Object:Clone()
				for Property, Value in next, OtherObject do
					if type(Property) == "number" then
						Value.Parent = Object
					else
						Object[Property] = Value
					end
				end

				Object.Parent = not Object.Parent and Parent
				Objects[a] = Object
			end

			return Object, table.unpack(Objects, 1, Length)
		else
			return Object
		end
	end

	return ClosureFunction
end

return Make
1 Like

Whoops, forgot about the parenthesis.
Yeah, you’ll need those otherwise the not will cause the Instance to be false (and therefore not true).