local API = require(script.Parent:WaitForChild("TrelloAPI"))
local WhitelistBoardID = API:GetBoardID("Roblox1R4Whitelist")
local WhitelistID = API:GetListID("Whitelisted",WhitelistBoardID)
local function CheckPlayerWhitelisted(Player)
local IsWhiteListed = false
local WhitelistCards = API:GetCardsInList(WhitelistID)
for _, Card in pairs(WhitelistCards) do
if string.find(Card.Name, Player.UserId) then
IsWhiteListed = true
else
IsWhiteListed = false
end
end
return IsWhiteListed
end
local function BanUnwhitelisted()
while true do
task.wait(5)
local Players = game.Players:GetChildren()
for _, Player in pairs(Players) do
local IsWhitelisted = CheckPlayerWhitelisted(Player)
if IsWhitelisted == false then
Player:Kick("You are not whitelisted. Contact the owner to be whitelisted.")
else
print("Player is whitelisted")
end
end
end
end
local BanUnwhitelistedCoroutine = coroutine.create(BanUnwhitelisted)
coroutine.resume(BanUnwhitelistedCoroutine)
game.Players.PlayerAdded:Connect(function(Player)
print("Player joined")
local IsWhitelisted = CheckPlayerWhitelisted(Player)
if IsWhitelisted == false then
Player:Kick("You are not whitelisted. Contact the owner to be whitelisted.")
else
print("Player is whitelisted")
end
end)
Problem with code: the Card returns nil and so it bans players even if a card with their userid is in a list, also I enabled http requests and also set the right token and key on the Trello module(Trello API [Original] - Roblox).
I checked if the name of the board was correct and also if it was private.(its in workspace visible mode)