You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I am working on a bans system that connects to Trello and uses the cards stored in a list to identify a banned player (the names of the cards are the User IDs). It should do a loop every now and then to make sure anyone who is in the server who may have been banned should be kicked.
What is the issue? Include screenshots / videos if possible!
I am repeatedly getting the error: HTTP 429 (Too many requests)
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve tried adding debounces, increased the tick value in the renderStepped function and even rewrote the whole script to call the requests in a while loop, but to no avail because then I get argument 1 missing or nil, or something similar.
This is the Moderation server script located in ServerScriptService (sensitive info has been removed):
--code removed as the issue is solved
This is the function that is stored in the TrelloModule module script (stored inside the moderation script)
It looks like you’re requesting the entire banlist whenever a player joins. You should instead request the banlist every x minutes and store the data in a table. Now whenever a player joins, you just have to take the data from the table.
local BanData = {}
local BanListId = 000000000
local BanListURI = "https://api.trello.com/1/lists/"..trello.BanListId.."/cards"
local requestCooldown = 360
function trello.GetRequest(url)
local request = url .. "?" .. trello.QueryParams
local response = httpService:GetAsync(request)
return response
end
while wait(requestCooldown) do
local response = trello.GetRequest(BanListURI)
BanData = httpService:JSONDecode(response)
end
Sorry I’m not a particularly good scripter, how would that look in the final script with everything else? (In the Moderation script or TrelloModule script)
I’ve added it all to the Moderation script, no errors but now it just doesn’t work at all. It’s probably to do with the table and whether or not the data is being called correctly but I just don’t know how to do something like that
Oh wait nevermind!!! I just reshuffled some blocks of code around, moved the wait(requestCooldown) to the end of the while loop and it’s worked! No errors at all. Thank you!