Kronos_Client.Dependencies.UI.Default.AdminLists:27: attempt to index number with 'match'

I have been working on a custom Kronos admin system for the last couple of days. I just completed it last night, and the ;admins command has broken. I have looked into numerous fixes but none have solved the issue. The error is Kronos_Client.Dependencies.UI.Default.AdminLists:27: attempt to index number with ‘match’, and the full module script is listed below.

client = nil
service = nil

return function(data)
	local window = client.UI.Make("Window",{
		Name  = "Adminlists";
		Title = "Admin Lists";
		Size  = {465, 325};
		AllowMultiple = false;
	})
	local tabFrame = window:Add("TabFrame",{
		Size = UDim2.new(1, -10, 1, -10);
		Position = UDim2.new(0, 5, 0, 5);
	})
	
	local lists = {
		Mods = tabFrame:NewTab("Moderators", {Text = "Moderators"}), 
		Admins = tabFrame:NewTab("Admins", {Text = "Admins"}),
		Owners = tabFrame:NewTab("Owners", {Text = "Owners"}),
		Creators = tabFrame:NewTab("Creators", {Text = "Creators"}),
		InGame = tabFrame:NewTab("InGame", {Text = "In Game"}),
	}
	
	local function makeList(list, items)
		for i = 1, #items do
			local Name, Trello = items[i]:match("^%S+"), items[i]:match("%[(%w+)%]$")
			list:Add("TextLabel", {
				Text = "  "..Name.." ";
				ToolTip = Name;
				BackgroundTransparency = (i%2 == 0 and 0) or 0.2;
				Size = UDim2.new(1, -10, 0, 30);
				Position = UDim2.new(0, 5, 0, (30*(i-1))+5);
				TextXAlignment = "Left";
				Children = {
					TextLabel = {
						Text = Trello or "";
						Size = UDim2.new(0, 100, 1, 0);
						Position = UDim2.new(1, -100, 0, 0); 
						BackgroundTransparency = 1;
					}
				}
			})
		end
		list:ResizeCanvas(false, true, false, false, 5, 5)
	end
	makeList(lists.Mods, data.Moderators)
	makeList(lists.Admins, data.Admins)
	makeList(lists.Owners, data.Owners)
	makeList(lists.Creators, data.Creators)
	makeList(lists.InGame, data.InGame)
	--[[
	lists.Mods:Add("ScrollingFrame",{
		List = data.Moderators;
		ScrollBarThickness = 2;
		BackgroundTransparency = 1;
		Position = UDim2.new(0, 5, 0, 0);
		Size = UDim2.new(1,-10,1,0);
	})
	lists.Admins:Add("ScrollingFrame",{
		List = data.Admins;
		ScrollBarThickness = 2;
		BackgroundTransparency = 1;
		Position = UDim2.new(0, 5, 0, 0);
		Size = UDim2.new(1,-10,1,0);
	})
	lists.Owners:Add("ScrollingFrame",{
		List = data.Owners;
		ScrollBarThickness = 2;
		BackgroundTransparency = 1;
		Position = UDim2.new(0, 5, 0, 0);
		Size = UDim2.new(1,-10,1,0);
	})
	lists.Creators:Add("ScrollingFrame",{
		List = data.Creators;
		ScrollBarThickness = 2;
		BackgroundTransparency = 1;
		Position = UDim2.new(0, 5, 0, 0);
		Size = UDim2.new(1,-10,1,0);
	})
	lists.InGame:Add("ScrollingFrame",{
		List = data.InGame;
		ScrollBarThickness = 2;
		BackgroundTransparency = 1;
		Position = UDim2.new(0, 5, 0, 0);
		Size = UDim2.new(1,-10,1,0);
	})
	]]
	
	window:Ready()
end
1 Like

Update: The GUI shows after you run ;re, no clue why.

Whatever you’re passing to the function (data) has a number instead of a string in the “Admins” table (or maybe Moderators? the stack trace should say) as one of its values.

2 Likes

Alright one moment let me look into that.