Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why wont this work? (GUI to Trello)

Asked by
ikiled 75 Donator
9 years ago

So, I am not sure whats going wrong in this, i've been trying a while to fix this. What I want is it to connect to trello, and if the Player = a person in trello (ON A CARD) then it will just end. But if they are NOT on the trello card then the gui will remove.

Storage     = game:GetService("ServerStorage")
RStorage    = game:GetService("ReplicatedStorage")
Teams       = game.Teams
Denied = {}
Access      = {}

--

function checkOkToLetIn(name) 
    for i = 1,#Access do 
        if (string.upper(name) == string.upper(Access[i])) then return true end 
    end 
    return false 
end 

if (checkOkToLetIn(script.Parent.Parent.Parent.Name)) then 
print("Completed")  
else script.Parent:remove()
end 




function GetPlr(plr, str)
local plrz = {} str = str:lower()
if str == "all" then plrz = game.Players:children()
elseif str == "others" then for i, v in pairs(game.Players:children()) do if v ~= plr then table.insert(plrz, v) end end
else
local sn = {1} local en = {}
for i = 1, #str do if str:sub(i,i) == "," then table.insert(sn, i+1) table.insert(en,i-1) end end
for x = 1, #sn do 
if (sn[x] and en[x] and str:sub(sn[x],en[x]) == "me") or (sn[x] and str:sub(sn[x]) == "me") then table.insert(plrz, plr)
elseif (sn[x] and en[x] and str:sub(sn[x],en[x]) == "random") or (sn[x] and str:sub(sn[x]) == "random") then table.insert(plrz, game.Players:children()[math.random(#game.Players:children())])
elseif (sn[x] and en[x] and str:sub(sn[x],en[x]):sub(1,4) == "team") then
if game:findFirstChild("Teams") then for a, v in pairs(game.Teams:children()) do if v:IsA("Team") and str:sub(sn[x],en[x]):sub(6) ~= "" and v.Name:lower():find(str:sub(sn[x],en[x]):sub(6)) == 1 then 
for q, p in pairs(game.Players:children()) do if p.TeamColor == v.TeamColor then table.insert(plrz, p) end end break
end end end
elseif (sn[x] and str:sub(sn[x]):sub(1,4):lower() == "team") then
if game:findFirstChild("Teams") then for a, v in pairs(game.Teams:children()) do if v:IsA("Team") and str:sub(sn[x],en[x]):sub(6) ~= "" and v.Name:lower():find(str:sub(sn[x]):sub(6)) == 1 then 
for q, p in pairs(game.Players:children()) do if p.TeamColor == v.TeamColor then table.insert(plrz, p) end end break
end end end
else
for a, plyr in pairs(game.Players:children()) do 
if (sn[x] and en[x] and str:sub(sn[x],en[x]) ~= "" and plyr.Name:lower():find(str:sub(sn[x],en[x])) == 1) or (sn[x] and str:sub(sn[x]) ~= "" and plyr.Name:lower():find(str:sub(sn[x])) == 1) or (str ~= "" and plyr.Name:lower():find(str) == 1) then 
table.insert(plrz, plyr) break
end
end 
end
end
end
return plrz
end
--

function recursive(source, t) if t == nil then t = {} end for _,v in pairs(source:GetChildren()) do table.insert(t, v) recursive(v, t) end return t end 
--

function CheckVIP(plr)
    for i,v in pairs(Access)do
        if(string.lower(plr.Name)==string.lower(v))then
            return true
        end
    end
end
--
function CheckBan(plr)
    for i,v in pairs(Blacklist)do
        if(string.lower(plr.Name)==string.lower(v))then
            return true
        end
    end
end

function BlacklistChecker(Player)
    for i,v in pairs(MVIP)do
        if Player.Name:lower() == v:lower() then
            --print(Player.Name)
            --print(v)
            return true
        end
    end
end
--
function Search(Player)
pr = game.Players:GetPlayers()
for i = 1, #pr do
if string.match(string.lower(pr[i].Name),Player) then
plr = pr[i]
return plr.Name
else
return false
end
end
end
--
function GetTime()
local hour = math.floor((tick()%86400)/60/60) local min = math.floor(((tick()%86400)/60/60-hour)*60)
if min < 10 then min = "0"..min end
return hour..":"..min
end
--
function Date(secs)
    local Days = secs/86400 - 365*2
    local TotalDays = math.floor(Days)
    local LeapCycles = math.floor(Days /1461)

    local ExtraYears = math.floor((Days % 1461)/365)
    local Year = LeapCycles * 4 + ExtraYears
    local ExtraDays = TotalDays - LeapCycles * 1461 - ExtraYears * 365
    local Months = {{"Jan", 31}, {"Feb" , (ExtraYears == 0 and 29) or 28}, {"Mar", 31}, {"Apr", 30}, {"May", 31}, {"Jun", 30}, {"Jul", 31}, {"Aug", 31}, {"Sep", 30}, {"Oct", 31}, {"Nov", 30}, {"Dec", 31}}
    local CurrentDate

    local Hour = math.floor((secs % 86400)/3600)
    local Minute = math.floor((secs % 3600)/60)
    local Second = math.floor(secs % 60)
    local TwelveH = Hour % 12

    for i,v in pairs(Months) do
        if v[2] < ExtraDays then
            ExtraDays = ExtraDays - v[2]
        else
            CurrentDate = v[1] .. " " .. ExtraDays .. ", "
            break
        end
    end

    local TotalDate = CurrentDate .. (Year + 1972).. ", " .. (TwelveH >= 10 and "" or "0") .. TwelveH .. ":" .. (Minute >= 10 and "" or "0").. Minute .. ":" .. (Second >= 10 and "" or "0") .. Second .. ((Hour >= 12 and " PM") or " AM") 
    return TotalDate
end
--
function ClearTable(tbl)
    for i,v in pairs(tbl) do
        table.remove(tbl,i)
    end
end

function runtrelloupdater()
local httpser=game:service('HttpService')
local get=httpser:GetAsync('https://api.trello.com/1/boards/FKF9GSj9/lists',true)
local tabel=httpser:JSONDecode(get)
ClearTable(Access)
for i,v in pairs(tabel) do

    if v.name:match('^GUI%s?$') then
        local getcard=httpser:GetAsync('https://api.trello.com/1/lists/'..v.id..'/cards',true)
        local tabal=httpser:JSONDecode(getcard)
        for l,k in pairs(tabal) do
        table.insert(Access,k.name)
        --print(k.name)
        end

    elseif v.name:match('^Denied%s?$') then
        local getcard=httpser:GetAsync('https://api.trello.com/1/lists/'..v.id..'/cards',true)
        local tabal=httpser:JSONDecode(getcard)
        ClearTable(Denied)
        for l,k in pairs(tabal) do
        table.insert(Denied,k.name)
        --print(k.name)
            end
        end
    end
end

runtrelloupdater() while wait(30) do runtrelloupdater() print("GUI Synced " .. Date(tick())) end

Please dont steal the script either!

Thank you in advanced if somone helps me!

4
That script is really long. No one will read all of it. EzraNehemiah_TF2 3552 — 9y
0
Lord, most of it is just the time function which isn't erroring. and the search through teams function at the top. ikiled 75 — 9y

2 answers

Log in to vote
0
Answered by 8 years ago

Trello API requires HTTPEnabled to be on.

Ad
Log in to vote
0
Answered by 9 years ago

Can you post the error?

Answer this question