Admin Commands Giving an Error

I want to make a Successful admin system

It will Not do any of the admin commands that i wrote the script for

so the Admin commands were of alvin blox tutorial and i get a error

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

-- the code block where its wrong is
local function findPlayer(name) --string
	for i, player in pairs(game.Players:GetPlayers()) do
		if string.lower(player.Name) == name then
			return player
		end
	end
	return nil
end

a screenshot is this

That means “player” is nil, make sure you’re calling the function and passing a valid player object as an argument.

The output log indicates that your complications arise in the isAdmin function, not the findPlayer function. This error is caused by a nil value being passed in as an argument for the isAdmin function. Assuming that it is legal for the player to be a nil value based on your findPlayer function, replace your isAdmin function with the following code.

local function isAdmin(player)
	for _,v in pairs(admins) do
		if v == nil then continue end
		if v == player.Name then
			return true
		end
	end
	return false
end

Remember to replace your isAdmin function with this code, not your findPlayer function.