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

How do you Insert a Script with HttpService

Asked by 10 years ago

I mean like PasteBin Source so i want to get the PasteBin code i put there to go into a Script on ROBLOX

3 answers

Log in to vote
3
Answered by 10 years ago

For Pastebin, it's actually quite simple. Every paste you create on Pastebin is also given a webpage purely for its raw paste data. For instance, I just created a paste that says

print("Hello, World!")

(You can find it here.)

Now, if you click "RAW" next to "DOWNLOAD," you'll be redirected to that webpage. The webpage in question for the paste I created is here.

Now you can simply call the :GetAsync() method on that webpage's source, and call the loadstring() function on the source that is returned.

local HttpService = game:GetService("HttpService")
loadstring(HttpService:GetAsync("http://pastebin.com/raw.php?i=XahrgvKq"))()
Ad
Log in to vote
1
Answered by 10 years ago

I don't think you can edit the source of a script since it is locked.

http://wiki.roblox.com/index.php?title=Source_(Property)/script

0
This is true, but you can still use loadstring to load an external string. User#11893 186 — 10y
Log in to vote
0
Answered by 6 years ago

If your talking about running the script in the pastebin, yes. First for this, go to ServerScriptService and enable LoadStringEnabled. There will be a popup. Click yes on that. Also, go to HttpService and enable it through the properties. Then, use the following script in a SERVER SCRIPT ONLY. Side note:Make the paste public or unlisted. If it is private, it will not work.

local web = '' --Insert your link for your script when it is raw. Ex:https://pastebin.com/raw/aBCdEFg. Make sure the /raw/ part is in the link.
local http = game:GetService('HttpService')
local code = http:GetAsync(web, true)
loadstring(code) --Loadstring runs the code in the parameter. It can run multiple lines of code if you put a space between every line.

Otherwise, just copy and paste your paste on the website and put it in a script.

Answer this question