Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

so im making like a whitelist with http service how would i convert this to a table?

im using pastebin to do this whitelist thing for a thinger im making ok and i cant figure out how to convert the string into a table helpz thx

HTTP = game:GetService('HttpService')
function WhiteListCheck(id)
	local code = HTTP:GetAsync('https://pastebin.com/raw/DLm9vHYw', true)
	print(code)
	for i,v in pairs(code) do
		if game.CreatorId == v then -- how i convert to table m8
			return true
		end
	end
end
if WhiteListCheck() then
	warn('Thanks for using Check In Now!')
else
	warn('You must purchase Check In Now to use it!')
end
11:41:20.971 - Players.Trolna.PlayerGui.ScreenGui.Scripts.CORE:7: bad argument #1 to 'pairs' (table expected, got string)

1 comment

0

so I am assuming that pastebin stores everything as a string

1 answer

✓ Accepted answer

No need to convert it to a table :P just use ':find'

HTTP = game:GetService('HttpService')

function WhiteListCheck(id)
	local code = HTTP:GetAsync('https://pastebin.com/raw/DLm9vHYw', true)
	print(code)
	if code:find(game.CreatorId) then
		return true
	end
	return false
end

if WhiteListCheck() then
	warn('Thanks for using Check In Now!')
else
	warn('You must purchase Check In Now to use it!')
end

This discussion is preserved as it was. New answers, comments, and votes are closed.