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

How can i make a script that will choose a random line of text from pastebin?

Asked by 4 years ago

Basically, I want to be able to make it print a random line from a pastebin; for example:

Pastebin

we are number 1
yes we are winning
oh my goodness!

NO I DO NOT WANT A METHOD USING LUA INSTEAD.

Current Code

local url = "http://pastebin.com/raw/myepicpaste"
local pastebinText = game:GetService("HttpService"):GetAsync(url, true) --the "true" as 2nd argument is to prevent it from caching the response, although I guess its not necessary here
local key = Random(pastebinText)
print(key)
    return key == pastebinText

Not Working

0
pastebinText is an entire string of the pastebin content. If you want each line, you'll have to tell it to. Use gmatch to get each line and put that line in a table, then index a random position of the table to retrieve a random line. The pattern could be as follows: "(%w+)[\n\r]?" which means 'one or more sequential valid characters until an optional line break'. pidgey 548 — 4y
0
that never helped at all JamiethegreatQ777 16 — 4y

Answer this question