local API = require(game.ServerScriptService:WaitForChild("TrelloAPI"))
local BoardID = API:GetBoardID("BoardTest1")
local ListID = API:GetListID("Listofban")
local Banned = API:GetCardsInList(ListID)
function checkBanned(name)
local isBanned = false
for i,v in pairs(Banned) do
if v.name == name then
isBanned = true
end
end
return isBanned
end
game.Players.PlayerAdded:connect(function(player)
if checkBanned(player.Name) == true then
player:Kick("Banned from the game")
end
end)
So I am trying to make a trello ban list. The code above does not work and I am not so sure on why it wont work. I am using nstrike159 Trello API. Link
I highly suggest using a players UserId to store instead of a username as, unlike a UserId, a username can change.
The issue lies in the method call to GetListID.
You are only passing the name of the list. The API requires both the name AND board ID.
In this case,
local ListID = API:GetListID("Listofban", BoardID)
I went ahead and wrote up the code using UserIds instead of Usernames below.
local API = require(game.ServerScriptService:WaitForChild("TrelloAPI"))
local BoardID = API:GetBoardID("BoardTest1")
local ListID = API:GetListID("Listofban", BoardID)
local Banned = API:GetCardsInList(ListID)
function checkBanned(player)
for _,card in pairs(Banned) do
if tonumber(card.name) == player.UserId then
return true
end
end
return false
end
game:GetService("Players").PlayerAdded:Connect(function(player)
if checkBanned(player) then
player:Kick("Banned from the game")
end
end)
On a side note, I recommend reading through the documentation that nstrike159 provided as it has extremely useful information on what arguments to pass and expect in a response.
It appears you’re working with a rather outdated trello module. I’d recommend using this one as it’s pretty nifty and up-to-date. It’s also easier to work with.
Here’s an example I use in one of my games
local Trello = require(script.Trello.Main)
local MainBoard = Trello:GetBoardByName("Sith Empire")
local SupportersList = MainBoard:GetListByName('Early Supporters')
game:GetService('Players').PlayerAdded:Connect(function(Player)
local Fcard = SupportersList:GetCardByName(tostring(Player.Name))
if not Fcard then
local NewCard = Trello.new("Card", tostring(Player.Name), SupportersList)
Player:Kick('[SUCCESS] You have been successfully verified as a early supporter of the Empire!')
else
Player:Kick('[ERROR] You have already been successfully verified as a early supporter of the Empire!')
end
end)
requires both a list name and board ID to be passed as arguments.
In your case, you only passed the list name to the function and not the board ID.
On top of that, I do suggest taking a look into the newer trello API that @LordMerc linked as the one you are using is outdated and limited in terms of features.