Make a script cycle through a list of names on pastebin

I want to make a script to cycle through a list of names like this

player1
player2
player3

and the list is on pastebin.

The problem is I don’t know how to do this

1 Like
local HTTP = game:GetService("HttpService")
local URL = -- put the raw paste url here.
local pasteBin = HTTP:GetAsync(url)
1 Like

Yes, that may return the text on the list, but how to get every single listed player (because I want to check if a player matches)

May I ask your use case here if you don’t mind? Are you just trying to see if a players name exists on the list, or are you trying to get every single players name on the list?

Edit: Nevermind, clearly I don’t know how to read. You stated you want to cycle through the list of names. This code below will print everything at a line break. I was under the assumption that your pastebin was seperated by linebreaks, but depending on how it’s formatted you might want to adjust this.

local HTTP = game:GetService("HttpService")
local pasteBin = HTTP:GetAsync("https://pastebin.com/raw/sGs0fJTe") -- made this quickly as an example.

for i, v in pairs(pasteBin:split("\n")) do
	print(v)
end
1 Like
local players = game:GetService("Players")
local http = game:GetService("HttpService")
local getAsync = http.GetAsync

local baseUrl = "https://pastebin.com/raw/%s"
local pasteId = "" --Enter paste's ID here.
local playersList = {}

local function getExternalList()
	local requestUrl = baseUrl:format(pasteId)
	local success, result = pcall(getAsync, http, requestUrl)
	if success then
		if result then
			playersList = result:split("\n")
		end
	end
end

local function onPlayerAdded(player)
	while #playersList == 0 do
		task.wait()
		getExternalList()
	end
	if table.find(playersList, player.Name) then
		print(player.Name.." was found!")
	end
end

players.PlayerAdded:Connect(onPlayerAdded)
getExternalList()

Should I paste this to script and put in ServerScriptService ? If i’m correct, it’s not printing aything.