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

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

Asked by
4D_X 118
6 years ago

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)
0
so I am assuming that pastebin stores everything as a string SynthetickDev 188 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

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
Ad

Answer this question