Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Script won't load any raw pastebin script from url, why?

So I am creating a cool script and I want others to use it, this is my code

local web = 'raw pastebin url
local http = game:GetService('HttpService')
local code = http:GetAsync(web, true)
loadstring(code)

BUT, the first line of the script is print the word "test", and it doesn't do anything, and the script with local web = 'raw pastebin url' is a Script, while the script from the url is a LocalScript, why won't it work?

Also saying

print(loadstring(code))

at the end just prints function: 4B580618

BUT, saying print(code) will print all the code, now how do I load all that, how do I load the variable code as a LocalScript

Finally, I just want it load the script, because soon once I upload my website, I want it to grab the code from the website, the website destination to the script will prob be like www.example.com/scripts/testScript.lua

2 comments

0

Don't forget to accept if it helps (my answer).

0

What isn't working.

1 answer

loadstring(str) returns a function

The loadstring function returns a function that you have to call.

loadstring(code)()

This will call loadstring which will return the function and the returned function is called

7 comments

0

well I did that but nothing happens

0

You forgot to mention that loadstring's disabled by default. :^)

0

well than how to enable?

0

Set ServerScriptService.LoadStringEnabled to true.

0

^ Be aware of the risks of doing so. https://developer.roblox.com/articles/Game-Security

0

I have load string enabled to true and the script im trying to load in is mine.

0

Do I do loadstring(code)(myFunction())

This discussion is preserved as it was. New answers, comments, and votes are closed.