so i made a admin gui with a whitelist thingy and its not working???
code:
local whitelistedkeys = "lolololl"
function whitelist()
if whitelistedkeys[TextBox.Text] then
djaijdaidnaiwdnaidnwhdniwh8237283728n8eh2n8e2e2n = true
else
djaijdaidnaiwdnaidnwhdniwh8237283728n8eh2n8e2e2n = false
end
end
TextButton.MouseButton1Click:connect(function()
whitelist()
if djaijdaidnaiwdnaidnwhdniwh8237283728n8eh2n8e2e2n == true then
print ("whitelisted")
elseif djaijdaidnaiwdnaidnwhdniwh8237283728n8eh2n8e2e2n == false then
print("no")
end
end)
what it does:
enter right key
checks, if right prints whitelisted else prints “no”
but when i input the correct key it still prints no?
this is the thing inside the pastebin
“key1”, “key2”
This script works fine, but you’re checking if the Textbox.Text is a key inside the string “lolololl”?? Did you mean to make whitelistedkeys an actual table? E.g
local whitelistedkeys = {["Key1"] = true, ["Key2"] = true}
Variables cannot contain more than one value, so “key2” is discarded in favor of “key1”. Strings have a metatable that has an __index field which points to the string table. Use a key that’s not in the string table and you get nil as a result.
Well to actually get the keys from the website you use HttpService functions. And only the server can make web requests so if the client really needs the keys from a website, use RemoteFunctions to get a table of the keys.
you should use JSONEncode to encode a table of keys (on pastebin), then use JSONDecode to get the keys (on studio)
to encode: local keys = {key = true} warn(game:GetService('HttpService'):JSONEncode(keys)) --// copy the output to pastebin
to decode: local ret = game:GetService('HttpService'):JSONDecode(game:GetService('HttpService'):GetAsync('https://pastebin.com/raw/bxW1eFRb')) --// do whatever you need to do