The basis of this script is a player's id is added as a card onto a list in trello.
Here is the entire code:
local HttpService = game.HttpService
local key = "REDACTED"
local token = "REDACTED"
local ListIds = {
SectionList = "REDACTED",
}
local function getCards(id)
return HttpService:JSONDecode(HttpService:GetAsync("https://api.trello.com/1/lists/"..id.."/cards?token="..token.."&key="..key))
end
local function createCard(cardData)
local url = "https://api.trello.com/1/cards"
HttpService:PostAsync(url, tostring(HttpService:JSONEncode(cardData)))
end
local List = getCards(ListIds.SectionList)
local NumDonors = #List
local Players = game.Players
local Section = script.Parent.Parent.Parent.Name
local SectionActive = false
local SectionLimit = script.Parent.Parent.Parent.TileSection.DonorTiles.Limit.Value
print(NumDonors)
print (SectionLimit)
if NumDonors < SectionLimit then
SectionActive = true
print(Section.." section is active")
end
function addcard(player)
if SectionActive then
local PlayerID = game.Players:GetUserIdFromNameAsync(player.Name)
print(PlayerID)
local data = {
["key"] = key,
["token"] = token,
["name"] = PlayerID,
["idList"] = ListIds.SectionList,
["desc"] = "",
}
createCard(data)
end
end
script.Parent.ClickDetector.MouseClick:Connect(addcard)
The error:
04:44:41.193 - HTTP 400 (Bad Request)
04:44:41.194 - Stack Begin
04:44:41.194 - Script 'Workspace.DonorTest.Sign.MAIN', Line 17 - function createCard
04:44:41.195 - Script 'Workspace.DonorTest.Sign.MAIN', Line 45 - function addcard
04:44:41.198 - Stack End
I took this script from an existing trello ban script in my game which doesn't give me any errors. And it has no issue getting the cards from the list, only when I'm attempting to add to the list.
