How to load a string from pastebin?

Soo I am trying to load a string of a paste bin url since I am trying to make a prototype of an anti-exploit and as to make it more secure and I have non-existing code because I don’t really know where to start.

3 Likes

All you would do is make a GET request to your raw paste.

Here is an example of a paste I posted, and the result in the console.

> print(game.HttpService:GetAsync("https://pastebin.com/raw/vArmU0Db"))
print("test pastebin")
5 Likes

Thanks very much for the solution, If I knowed that pastebin had a raw form of the code, thank you very much!

1 Like

Sorry about the bump, but how would I get it to print a string from a certain line…

Say if this was my Pastebin Raw file:

hello
hola
hi

and I wanted to print out the 3rd line on the list, how would I do this?

1 Like

You can use string.gmatch, though it’s a rather hacky method and isn’t really flexible. I suppose there’s a much better way to directly get a line from the pastebin, then through some string pattern, though it would work for your scenario. Incapaz likely knows a direct method.

local line = 0
for str in string.gmatch(RawText, "%a+") do
	line = line + 1
	if line == 3 then
		return str
	end
end

Slight problem with this code, it doesn’t allow you to get integers…

Input (raw):

11 A
22 B
33 C
44 D
55 E

output (for each string, etc);

A
B
C
D
E

You should really look into string patterns.
"%a" accounts for an uppercase or lowercase letter, hence it doesn’t work for integers.

You’ll need to account for digits by using "%d+" and "%s" for spaces/ whitespace character. Combine them together and you get a string pattern accounting for integer, letter and spaces. The string pattern could be something like : "%d+[%a%s]+"– returns e.g 11 A. Please do your research, you have the resources there. Feel free to continue this via dm’s as I don’t want to derail the topic and because OP already has their solution.

1 Like

So, im making some password or security gui. How would you get possible text inside of pastebin. For example in raw file there’s a three text/key like:

Pass1
Pass2
Pass3

and all of them will work when you input it will work, how?

If you want to get each line for possibilities try this