How do I make something like this? For example I give the script this link https://pastebin.com/raw/78VT3MUS it will print:
line1
line2
line4
How do I make something like this? For example I give the script this link https://pastebin.com/raw/78VT3MUS it will print:
line1
line2
line4
You can do this:
local http = game:GetService("HttpService")
http.HttpEnabled = true
local page = http:GetAsync("https://pastebin.com/raw/78VT3MUS")
print(page)
It sets HttpEnabled to true so that it's allowed to get the page, then gets that page with GetAsync.
(You have to turn on HTTP requests in your game settings for it to properly work)
edit: SHOOT I DIDN'T READ THE QUESTION RIGHT TRY THIS:
local lineNumber = 1
local http = game:GetService("HttpService")
http.HttpEnabled = true
local page = http:GetAsync("https://pastebin.com/raw/78VT3MUS")
local function parse(s) -- stole this, sorry ScriptGuider
local t = {};
for chunk in string.gmatch(s, "[^\n]+") do
t[#t+1] = chunk;
end;
return t;
end;
local foundPage = parse(page)
print(foundPage[lineNumber]) -- line1
This discussion is preserved as it was. New answers, comments, and votes are closed.
4 comments
I know how to use getasync but how do I get individual lines?
yeah you really didn't answer his question
also, what the hell is http.HttpEnabled? that doesn't work!
sorry, tried again