Attempt to call a table value

I want it to call the serverban function from the commands module.

---------------------------------- || Variables || ----------------------------------

local field = {} ; self = setmetatable({},field) ; field.__index = field  

local Services = require(script.Parent.Parent.Services)

local FunctionStorage = Services.ReplicatedStorage:WaitForChild("FunctionStorage")
local commands = FunctionStorage:FindFirstChild("Request"):InvokeServer("Commands")

local player = Services.Players.LocalPlayer

local UI = script.Parent.Parent.Parent.Panel.Pages.Moderation	
local HasUi = false

---------------------------------- || Methods || ----------------------------------

function field:Ban(Popup)
	warn(commands)
	commands[1].serverban({[1] = Services.Players:FindFirstChild(Popup.MainFrame.Frame.Title.Text)})
end

function field:Kick(Popup)
	warn(`kick`)
end

function field:jail(Popup)
	warn(`jail`)
end

function field:Options(plr)
	warn(plr)
	if HasUi then return end

	HasUi = true
	local Popup = UI.Parent.Parent.Parent.Configuration.UI.PopUps:WaitForChild("Players Choices"):Clone()["Players Choices"]

	Popup.Parent.Parent = player.PlayerGui

	Popup.MainFrame.Frame.Title.Text = plr.Name

	Services.TweenService:Create(Popup,TweenInfo.new(.5),{GroupTransparency = 0}) :Play()

	Popup.MainFrame.Frame.Options.Ban.MouseButton1Click:Connect(function()
		field:Ban(Popup)
	end)

	Popup.MainFrame.Frame.Options.Ban.TouchTap:Connect(function()
		field:Ban(Popup)
	end)

	Popup.MainFrame.Frame.Options.Kick.MouseButton1Click:Connect(function()
		field:Kick(Popup)
	end)

	Popup.MainFrame.Frame.Options.Kick.TouchTap:Connect(function()
		field:Kick(Popup)
	end)

	Popup.MainFrame.Frame.Options.Jail.MouseButton1Click:Connect(function()
		field:jail(Popup)
	end)

	Popup.MainFrame.Frame.Options.Jail.TouchTap:Connect(function()
		field:jail(Popup)
	end)
end

function field:ListPlayers()
	for _,Player in pairs(Services.Players:GetPlayers()) do

		if UI.MainFrame.PlayerList:FindFirstChild(Player.Name) then continue end

		local template = UI.MainFrame.PlayerList.Template:Clone()

		template.Parent = UI.MainFrame.PlayerList

		template.Frame.Title.Text = Player.Name
		template.Frame.Rank.Text = Player:GetAttribute("Rank") or "N/A"

		template.Frame.Hitbox.MouseButton1Click:Connect(function()
			field:Options(player)		
		end)

		template.Name = Player.Name

		template.Frame.Hitbox.TouchTap:Connect(function()
			field:Options(player)		
		end)

		template.Visible = true
	end
end

function field:PlayerRemoving(player)
	local temp = UI.MainFrame.PlayerList:FindFirstChild(player.Name)

	if temp then 
		temp:Destroy()
	end
end

---------------------------------- || RBX Signals || ----------------------------------

field:ListPlayers()

Services.Players.PlayerAdded:Connect(field.ListPlayers)

Services.Players.PlayerRemoving:Connect(function(player)
	field:PlayerRemoving(player)
end)

return field

Error line:


commands[1].serverban({[1] = Services.Players:FindFirstChild(Popup.MainFrame.Frame.Title.Text)})


Ah, It seems like it was just a case of me being stupid.

Sorry for wasting your time @Velover3454

no worries, did you fix your script?

Yes, thanks for the help!

Char limit

aaaaaaaaaaa

1 Like