How can I use that module script for execute a custom loadstring?

Hello Community,
This loadstring module is from the Adonis module but I don’t know how to use it for execute a loadstring. If you could help me it would be very cool, because I need that for my script who I take it from my webspace. Thansk for every awnser!

local waitDeps = {
	'Rerubi';
	'LuaK';
	'LuaP';
	'LuaU';
	'LuaX';
	'LuaY';
	'LuaZ';
}

for i,v in pairs(waitDeps) do script:WaitForChild(v) end

local luaX = require(script.LuaX)
local luaY = require(script.LuaY)
local luaZ = require(script.LuaZ)
local luaU = require(script.LuaU)
local rerubi = require(script.Rerubi)

luaX:init()
local LuaState = {}

getfenv().script = nil

return function(str,env)
	local f,writer,buff,name
	local env = env or getfenv(2)
	local name = (env.script and env.script:GetFullName())
	local ran,error = pcall(function()
		local zio = luaZ:init(luaZ:make_getS(str), nil)
		if not zio then return error() end
		local func = luaY:parser(LuaState, zio, nil, name or "::Adonis::Loadstring::")
		writer, buff = luaU:make_setS()
		luaU:dump(LuaState, func, writer, buff)
		f = rerubi(buff.data, env)
	end)
	
	if ran then
		return f,buff.data
	else
		return nil,error
	end
end

Before you even try using it, you need all the required modules

local waitDeps = {
	'Rerubi';
	'LuaK';
	'LuaP';
	'LuaU';
	'LuaX';
	'LuaY';
	'LuaZ';
}

Without these it won’t work anyway. Those modules can be found in the script you’ve provided.
Roblox also provides built-in loadstring however the Adonis module allows for a bypass to the game owner manually enabling loadstring execution.
I assume the script you have provided is a Module. That will require a Client Script or a Server Script to require the module and execute the function with the code that needs to be ran.

1 Like

You should try to get a standalone “custom loadstring” module, because modules from a bigger project expect the existance of other modules/assets/scripts

I now found this module script for loadstring:

local LoadString = require(script.Bytecode)

GetRandom = function(Len)
	local Length = (type(Len) == "number" and Len) or math.random(5,10)
	local Result = {}
	for Number = 1, Length do
		Result[Number] = string.format('%02x', math.random(126));
	end
	return table.concat(Result)
end

_G.Functions = {}
local Module = {}

function Module:Execute(Type, String)
	if not (Type and String) then
		return
	end
	
	local func = LoadString(String)
	local execid = GetRandom()
	
	local Base
	if Type == "Script" then
		Base = script.ScriptBase:Clone()
		local Value = Instance.new("StringValue", Base)
		Value.Name = "Execute"
		Value.Value = execid
		_G.Functions[execid] = func
	else
		Base = script.LocalScriptBase:Clone()
		local Value = Instance.new("StringValue", Base)
		Value.Name = "Execute"
		Value.Value = execid
		_G.Functions[execid] = func
	end
	
	return Base
end

return Module;

I now did this script but the script won’t execute in the Door module to operate it.

local load = require(script.Loadstring)

local HttpService = game:GetService("HttpService")

local URL_ASTROS = "https://private-scripts.glitch.me/Sensor_Door.lua"

local response = HttpService:GetAsync(URL_ASTROS)

load:Execute("Script",response)

I hope somewone could help me!

1 Like

There’s no way to know what’s wrong with it because the code is stored in a remote server, please do this print(response) and then check the output. Give us the output so we can figure out the error. Thanks.

The output is the code of script.Screenshot by Lightshot

This script doesn’t seem to do any actual “loadstringing”

Can I not execute the script via a loadstring? I would secure my code by this way and execute it with a loadstring. The script shoult get by a http request and the execute it as a script. I’m new in this theme.

The only way to “loadstring” is by using the built-in function loadstring(argstring), although it is possible to create a custom loadstring function (That’s hard though) a http request won’t help at all.

So this should work?

local HttpService = game:GetService("HttpService")

local URL_ASTROS = "https://private-scripts.glitch.me/Sensor_Door.lua"

local response = HttpService:GetAsync(URL_ASTROS)

loadstring(response)

yes, but you will need to have ServerScriptService.LoadstringEnabled set to true

Yeah I did but it don’t work. I did set it true but the script would not act like a script in the game.

Oh, you cannot set LuaSourceCountainer, it’s locked to robloxsecurity so that would be impossible

Where is the LuaSourceCountainer value?

It’s hidden, here it is the abstractclass.

It’s also know as “source”

So I cannot execute my script from the webspace as a script in the game?

no, unless that script already exists with loadstring() inside!

you need to do like this

require(script.Loadstring)(response)()
1 Like

you could also do that, but you forgot the brackets
like

loadstring(response)()