Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 5 years ago
Edited 5 years ago

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

0
Don't forget to accept if it helps (my answer). User#24403 69 — 5y
0
What isn't working. User#24403 69 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

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

0
well I did that but nothing happens Stanlyhalo 0 — 5y
0
You forgot to mention that `loadstring`'s disabled by default. :^) TheeDeathCaster 2368 — 5y
0
well than how to enable? Stanlyhalo 0 — 5y
0
Set ServerScriptService.LoadStringEnabled to true. LeadRDRK 437 — 5y
View all comments (3 more)
0
^ Be aware of the risks of doing so. https://developer.roblox.com/articles/Game-Security TheeDeathCaster 2368 — 5y
0
I have load string enabled to true and the script im trying to load in is mine. Stanlyhalo 0 — 5y
0
Do I do loadstring(code)(myFunction()) Stanlyhalo 0 — 5y
Ad

Answer this question