What Is a Loadstring in Roblox?

Last updated: By Delta Executor Team 10 min read

The one-line loadstring(game:HttpGet(...))() you copied from a script page downloads code from a link, turns that text into a function and runs it inside an executor such as Delta Executor. Loadstring is that middle step. So what is a loadstring? A Luau function that converts any text into code you can run.

What Is a Loadstring Function?

Loadstring means "load a string": a string is text, and loadstring loads that text as code. It does not run anything by itself. It hands you back a function, and that function only runs when you add () after it.

If the text is broken code, nothing crashes; loadstring returns nil (Lua's word for "nothing") plus an error message, so there is no function to run. You will sometimes see the two halves on separate lines, local f = loadstring(text) and then f(), which does exactly the same job. Roblox's reference lists a second, optional argument, chunkname: a label such as loadstring(text, "MyTest") that error messages show. That label helps when several loaded pieces of code could be at fault.

Loadstring Script Example

A harmless way to see the pattern is a line whose only job is to print a message. Run it and the words Hello from Delta appear in the console, the log window where Roblox and Delta report output and errors:

Lua
loadstring("print('Hello from Delta')")()
PartWhat it does
loadstring(Calls the function and opens its bracket.
"print('Hello from Delta')"The code, written as text. Double quotes wrap the outside, single quotes sit inside, and both must be straight, not curly “ ”.
)Closes loadstring. You now hold a function, but it has not run yet.
()Runs that function, so the message prints.

Once these four parts make sense, every longer loadstring is the same shape with different text inside.

What Does loadstring(game:HttpGet(...))() Mean?

loadstring(game:HttpGet(...))() downloads code from a web link with game:HttpGet, turns it into a function with loadstring and runs it with the final (). It is the same four-part pattern as above, except the code arrives from a link instead of being typed between the quotes.

Lua
loadstring(game:HttpGet("<raw link>"))()

Here <raw link> stands for the address of a plain-text script file. Normal Roblox games cannot call game:HttpGet; the executor adds it. Authors share code this way because, as Delta's developer docs put it, a long script may not fit in the editor. A link also lets them update the file without touching the line. If you want the difference between this one-line loader and a full pasted script, the guide on Roblox script files and raw links compares both.

How to Use a Loadstring Script in Roblox

To use a loadstring, copy the whole line, paste it into your executor's editor while you are inside a game, and press Execute. The four steps below work the same in any game.

  1. Copy the entire line from the script's page, or from Delta's Script Explorer (the cloud button). Check that it ends with )().
  2. Open Delta and join the game, then open the editor.
  3. Paste and run. Tap Execute; phones and emulators lay that screen out differently, and the Delta run guide covers every layout.
  4. Read the console if nothing happens. Press F9, type /console in the game chat, or open Delta's built-in console to see the error.

A line you plan to reuse can live in Delta's list of saved scripts in the script manager.

Does Loadstring Work in Roblox Studio?

Only in server scripts, and only after the game owner turns it on. Roblox ships loadstring switched off (the LoadStringEnabled setting in ServerScriptService defaults to false) and advises keeping it off. Running code from text can open a game to remote code execution.

That one rule is why the same line behaves so differently depending on where it runs:

Normal Roblox gameRoblox Studio, server ScriptExecutor such as Delta
Can loadstring run?NoOnly if LoadStringEnabled is tickedYes, the executor brings its own
Who controls itNobody, for your deviceThe game owner, in StudioThe executor, not the game
game:HttpGetNot availableNot available; servers use HttpServiceAdded by the executor
Main riskNone from loadstringText sent by players running on the serverUnknown code behind a link

A script cannot flip LoadStringEnabled; only the game owner can, in Studio, as Roblox's ServerScriptService reference states. Anyone hoping the F9 console can stand in for an executor will find the limits in Roblox scripts with no executor.

Why Does Roblox Say loadstring() Is Not Available?

You see "loadstring() is not available" when a LocalScript, code that runs on the player's device, calls loadstring, or when a server Script calls it while LoadStringEnabled is off. Even with the switch ticked, it covers server scripts only. Game makers fix it by moving the code to a server Script or by using a Lua-in-Lua module such as vLua. A player simply runs the line in an executor instead.

What Is Loadstring Used For?

Players meet loadstring as the one-line loader that pulls a script from a link into an executor. Inside real games it has a few real jobs too, all on the server and all with LoadStringEnabled ticked by the game owner:

  • Admin consoles. An admin types a line of code and the server runs it. Adonis, below, is one example.
  • Turning text into a value. Put return at the start of the text and the function hands back a result: loadstring("return 5 + 5 * 3")() gives 20. This is the classic calculator example on Roblox's developer forum.

Both jobs carry the risk Roblox warns about. If a player's own typing reaches a server loadstring, that player can run any code on the server. Roblox therefore tells developers to lock down what the function can reach with getfenv and setfenv. Its security guide for third-party models goes further and tells creators to be "especially cautious" about granting a model the LoadString capability, one of the powers backdoors commonly exploit.

Roblox's Creator Store rules also flag require(assetId) next to loadstring(), since both can load other code at runtime. That require route sits behind the require and server side scripts that sellers advertise. For a player, the takeaway is simpler: a loadstring runs whatever text it is given, with no check of its own.

What Is Adonis?

Adonis is a free, open-source admin system that game owners add to their own Roblox games, and "Adonis loadstring" is its built-in code runner for admins. It carries its own Lua-in-Lua module, so admin commands such as :s can run code without turning on LoadStringEnabled.

That runner is off by default (CodeExecution is false), and the real Adonis is installed by a game owner in Studio, inside ServerScriptService. A loadstring that pulls "Adonis" into an executor from a stranger's copy is not the real install.

How to Make a Loadstring Script

To make a loadstring, put your own script in a public text file online, copy its raw link, and drop that link into loadstring(game:HttpGet("..."))(). The raw link must show plain code in the browser, not a web page.

  1. Save your code as a file in a public GitHub repository or on a paste site.
  2. Open the file and tap Raw.
  3. Copy the address from the browser's address bar.
  4. Put it where <raw link> sits in the pattern above, then test it.

Watch for two problems. A private repository, a wrong file path or a deleted paste returns 404, so the line has no code to load. And after you edit the file, a GitHub raw link can lag behind. Raw GitHub files are served with a 300-second cache, so the new version can take up to 5 minutes to show. Anyone who wants to turn a handful of their own loadstrings into a menu can follow the steps to build your own Roblox script hub.

How to Convert a Loadstring to a Script

Copy the address between the quotes and open it in your browser. The plain text that appears is the full Roblox script: nothing installs, and you can read it or save it as a file. If that text is scrambled or only loads another link, you cannot tell what it will do. Some chains run two links deep: the Overflow loader for Animal Hospital is one line that fetches a second loader. An open-source loader such as the Infinite Yield admin script is the opposite case: its link leads to readable code on GitHub.

Is a Loadstring Safe to Run?

Loadstring only turns text into code, so a loader is exactly as safe as the file behind its link, and whoever controls that file can change it after you checked. Read the raw text first (see How to Check What a Raw Link Returns), and judge the source with the safe script source ranking before anything runs on your account.

Why Is My Loadstring Not Working?

A loadstring line fails when it is incomplete, has the wrong quotes, or points to a link that no longer returns code. Match what the console shows to a row below.

What you seeWhyFix
Nothing happens, no errorThe final () is missing, so the function is made but never runAdd () at the end
An error on "Line 1"A bracket or quote mark went missing or got reshaped on the wayCopy the full line again rather than fixing it by hand
"Error 404" or "HTTP 404"The executor could not fetch the link: the script was taken down or moved, or the link has a typoFind the script's updated source
"Attempt to call a nil value"The link returned something that isn't Lua (a web page instead of the Raw file, or a dead link), so loadstring gave back nil; or the script is out of dateUse the Raw link; if it is right, get an updated script
"Expected identifier when parsing expression, got Unicode character U+feff"The file starts with an invisible byte order mark, left by an editor that saved it as "UTF-8 with BOM"If it is your file, save it again as plain UTF-8; otherwise tell the author
"loadstring() is not available"The line ran in Studio or a LocalScriptRun it in an executor

When all you get is "attempt to call a nil value" from your own code, wrap the call as assert(loadstring(text))(). The Lua manual uses this form because assert stops on loadstring's own error message, which names the real typo instead of the vague nil error.

If the line itself is fine, the error comes from inside the script. It may be outdated or not made for that game, so get an updated version from its author. Other messages are listed in the Delta script error lookup.

Print the download instead of running it. Swap the outer loadstring(...)() for print(...), so the executor shows the text behind the link and runs none of it:

Lua
print(game:HttpGet("<raw link>"))

Real code in the console means the link is fine and any error comes from the script. A missing file on GitHub's raw server answers with the plain text 404: Not Found. That text is not Lua, so loadstring hands back nil and the final () turns it into "attempt to call a nil value". So a dead GitHub link shows up as that nil error rather than as a 404. Output that starts with <!DOCTYPE html> or other HTML tags means you copied a normal web page address, not the Raw one.

FAQ

Is loadstring the same as load?

Not in Roblox. Lua 5.2 and later replaced loadstring with load, but Roblox's Luau still uses loadstring and has no load function.

Does loadstring work on mobile?

Yes, inside a mobile executor such as Delta. The line is the same on a phone as on a PC, and only the way you paste it changes.

Can I hide my script inside a loadstring?

No. A loader only moves the code to a link, and anyone can open that raw link in a browser and read every line. Scrambled code does not help either, since players treat it as a warning sign.

How do you use loadstrings in Grow a Garden?

Copy, paste, execute, then check the console, exactly as on any other game. What each script for that game does, and its risk, is in the Grow a Garden script guide for Delta.

Why do executors need loadstring at all?

Script authors host their code online as raw files, and loadstring is the piece that turns that downloaded text into something the executor can run. How executors add functions that normal games lack is explained in how a Roblox executor works.

Can loadstring run compiled bytecode?

No. Roblox's loadstring accepts only readable Luau source, and Luau's own documentation calls exposing bytecode dangerous for sandboxing.

Conclusion

A loadstring line fetches text from a link, turns it into a function and runs it, so whoever controls that link controls what runs on your account. Read the raw text before you run it, and paste loaders only from sources you can trace. If the full line ends in )(), the console shows no error and still nothing happens, the Delta not injecting fix runs a one-line test that shows whether Delta is attached.