Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local print = rconsoleinfo or print
- local module
- function findvalue_in_table(value,tb)
- for _,v in pairs(tb) do
- if value == v then
- return true
- end
- end
- return false
- end
- function gethttp(url)
- local sus, errorstatement = pcall(function()
- return game:HttpGet(url)
- end)
- if sus then
- return errorstatement
- else
- print("[Library Loader][Get Http]FAILED".. errorstatement)
- return "ERROR"
- end
- end
- module = {
- LocalLoad = function(path_to_file)
- local path_to_file = path_to_file or ""
- local LibraryContent = readfile(path_to_file) or ""
- local n_er, Library = pcall(function()
- return loadstring(LibraryContent)()
- end)
- if n_er then
- return Library
- end
- end,
- ExternalLoad = function(url)
- local url = url or ""
- local LibraryContent = gethttp(url)
- if LibraryContent == "ERROR" then
- print("[Library Loader][URL Loader]FAILED TO LOAD EXTERNAL LIB"..LibraryContent)
- return
- end
- local n_er, Library = pcall(function()
- return loadstring(LibraryContent)()
- end)
- if n_er then
- return Library
- end
- end,
- Load = function(modulename)
- print("Loading"..modulename)
- if not isfolder("module") then
- makefolder("module")
- end
- local modules = listfiles("module")
- if findvalue_in_table(modulename,modules) then
- return module.LocalLoad("module/"..modulename..".lua")
- else
- local ScriptFromRepo = gethttp("https://raw.githubusercontent.com/plytalent/Roblox-Library-Repo/main/"..modulename:gsub("%s+","%%20")..".lua")
- if ScriptFromRepo ~= "404: Not Found" then
- return module.ExternalLoad(ScriptFromRepo)
- else
- rconsoleinfo("NOT FOUND MODULE")
- end
- end
- end
- }
- return module
Add Comment
Please, Sign In to add comment