I am working on making a leaderstat system that is based on Trello. However, it refuses to create a new list if one is not already present. This is my current code, any solutions? I am using this API: Trello API [Original] - Roblox EDIT: It reaches the umn print, then stops.
local TrelloAPI = require(script.Parent.TrelloAPI)
local BoardID = "ID"
game.Players.PlayerAdded:Connect(function(Plr)
print("Ready")
--Create leaderstats
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
local Ticks = Instance.new("IntValue")
Ticks.Parent = leaderstats
--Connect to Trello
local foundUser = false
for i,l in pairs(TrelloAPI:GetLists(BoardID)) do
if l.name == Plr.UserId then
foundUser = true
local lid = TrelloAPI:GetListID(l.name,BoardID)
for i,c in pairs(TrelloAPI:GetCardsInList(lid)) do
if c then
local statValue = tonumber(c.name)
Ticks.Value = statValue
print("Ticks Loaded")
end
end
end
end
print("hi")
if foundUser ~= true then
print("umn")
local newUser = TrelloAPI:AddList(Plr.UserId,BoardID)
print("1")
local lid = TrelloAPI:GetListID(Plr.UserId,BoardID)
print("2")
local newValue = TrelloAPI:AddCard("0",lid)
print("Created new Ticks stat")
print("kewl")
end
--Finalize
print("ok?")
leaderstats.Parent = Plr
if not Plr:FindFirstChild("leaderstats") then
Plr:Kick("Unable to load/ create global ticks. Please rejoin to try again.")
end
end)
I have already followed the guide before, this isn’t my first time using the API and it worked the previous time. I already said that the last print is at umn, there are no errors it just cuts off there.
Like I’ve said, I wouldn’t know. I’d suggest trying to reach the person who has created that tutorial for help. I’ve done it before with Firebase and figured out the issue.
The problem isn’t your coding it’s most likely what’s going on with Trello or the Trello module itself. I know for a fact that the module itself is old and has caused problems for me overtime.
Although if you’re certain that the module is fine, make sure that your bot has the right permissions to create a list and make sure it does have access to your board. You may also want to be careful that you’re not going over the API limit or it may stutter and error.
I noticed when using the trello API I had to limit myself on how many times I could use GetCardsInList and I couldn’t even use the CardAdded/CardRemoved function at all. I highly recommended using a better alterantive such as DataStores and MessagingService even though trello itself is very convient so it’s up to you.