So, I've made the script which recognises the group ID, etc... But now I am trying to sync it with trello, and help?

Errors: 16:01:45.069 - Can't convert to JSON Line 1 16:01:45.070 - Script 'Workspace.TrelloAPI', Line 605 - method AddCard

local data=HS:JSONEncode(dat)

Line 2 16:01:45.072 - Script 'Players.Player.PlayerGui.Application.Frame.create.Script', Line 16

 local CardID = ap:AddCard("[NS] " .. group.Name, game.Players.LocalPlayer.Name, id, ListID)

TrelloAPI Function for AddCard

	function T:AddCard(...)
		local url
		local args={...}
		local dat
		if #args==3 then
			local nam,des,lid=args[1],args[2],args[3]
			dat={
			name=nam,
			desc=des.."",
			idList=lid,
			urlSource=nil,
			due=nil
			}
		elseif #args==4 then
			local nam,des,lid,url=args[1],args[2],args[3],args[4]
			dat={
			name=nam,
			desc=""..des,
			idList=lid,
			urlSource=url,
			due=nil
			}
		elseif #args==5 then
			local nam,des,lid,url,po=args[1],args[2],args[3],args[4],args[5]
			dat={
			name=nam,
			desc=""..des,
			idList=lid,
			urlSource=url,
			pos=po,
			due=nil
			}
		elseif #args==6 then
			local nam,des,lid,url,po,de=args[1],args[2],args[3],args[4],args[5],args[6]
			dat={
			name=nam,
			desc=""..des,
			idList=lid,
			urlSource=url,
			pos=po,
			due=de
			}
		elseif #args==7 then
			local nam,des,lid,url,po,de,label=args[1],args[2],args[3],args[4],args[5],args[6],args[7]
			dat={
			name=nam,
			desc=""..des,
			idList=lid,
			urlSource=url,
			pos=po,
			due=de,
			labels=label
			}
		elseif #args==8 then
			local nam,des,lid,url,po,de,label,cc=args[1],args[2],args[3],args[4],args[5],args[6],args[7],args[8]
			dat={
			name=nam,
			desc=""..des,
			idList=lid,
			urlSource=url,
			pos=po,
			due=de,
			labels=label,
			idCardSource=cc
			}
		end
		local data=HS:JSONEncode(dat) --Error here
		if Private then
			getAddon()
			url="https://api.trello.com/1/cards"..addon
		else
			 getAddon()
			 url="https://api.trello.com/1/cards"..addon
		end
		local re=HS:PostAsync(url,data)
		return HS:JSONDecode(re)
	end

My script

local create = script.Parent
local frame = script.Parent.Parent
local id = script.Parent.Parent.groupID.Text
local plr = game.Players.LocalPlayer 
local ap = require(game.Workspace.TrelloAPI)
local id = script.Parent.Parent.groupID


create.MouseButton1Click:connect(function()
    local groupID = tonumber(id.Text) -- Use more variables and organize your code.
    if plr:GetRankInGroup(groupID) == 255 then
        wait()
        local group = game:GetService("GroupService"):GetGroupInfoAsync(tonumber(id.Text))
        local BoardID = ap:GetBoardID("Appalachian Security Contract Application")
        local ListID = ap:GetListID("Applied",BoardID)
        local CardID = ap:AddCard("[NS] " .. group.Name, game.Players.LocalPlayer.Name, id, ListID) --Error here
        print("He's the owner!!!!")
        script.Parent.Parent.create.Visible = false
        wait(3)
    game.Players.LocalPlayer:Kick("Thank you for choosing Appalachian Private Security Company, we hope you choose us again! -APSC")
	
    else
		print("He's NOT the owner!!!!")
		script.Parent.Parent.Warn.Visible = true
		script.Parent.Parent.create.Visible = false
		wait(5)
		script.Parent.Parent.Warn.Visible = false
		script.Parent.Parent.create.Visible = true
    end
end)

1 comment

0

The problem here is probably that JSONEncode is fed arguments it can't convert to JSON, namely "id". What is "script.Parent.Parent.groupID"?