Table Expected, Got Nil

I’m trying to make an admin system for my API, and my it is saying that there isn’t a table,

function Swift.SetAdmin(player, List)
	for i,v in pairs(List) do
		if player.playerID == v then
			local Admin = Instance.new("BoolValue", player)
			Admin.Value = true
		end
	end
end
local Swift = require(script.Parent)

local Admin = {
	200357169,--twichman123
	1, --Roblox
}

--Make sure you put the ID of a player, not their name
game.Players.PlayerAdded:Connect(function(player, Admin)
	Swift.SetAdmin(player)
end)

You never gave the Admin table to the SetAdmin function, also, remove the , Admin from the function brackets, you cna’t provide custom parameters

local Players = game:GetService("Players")

local Swift = require(script.Parent)

local Admin = {
	200357169,--twichman123
	1, --Roblox
}

--Make sure you put the ID of a player, not their name
Players.PlayerAdded:Connect(function(player)
	Swift.SetAdmin(player, Admin)
end)

Also in your SetAdmin function it will still error because it’s UserId, not playerID

2 Likes