Server returning error when running :Kick()

So I’m trying to make a Blacklist command and for some reason the server keeps returning an odd error. You can see my code and the error below:

image

game.Players.PlayerAdded:connect(function(plr)
	plr.Chatted:connect(function(message)
		local msg = message:split(" ")
		if msg[1] == ".blacklist" then
			game.Players:FindFirstChild(msg[1]):Kick("You've been blacklisted by an Administrator.")
			--print("command used")
		end
	end)
end)

Anyone notice anything wrong?

You’re doing a lot of unnecessary things on the 5th line. Your current code is attempting to find game.Players[".blacklist"] which obviously isn’t a player.

Replace that line with:

plr:Kick("Message")

or if you’re trying to get a player from the arguments:

game.Players[msg[2]]:Kick("Message")
4 Likes

HAHA OMG. I DIDN’T EVEN NOTICE THE MSG[1]. TYSM for your help!

I have another question. When I’m requring a module, my script seems to not work. But when I don’t require a module, for some reason it works again. Do you have a fix for that?

Without knowing what the module is, it’s hard to say. The potential issues are probably the module not returning anything, improper requiring, or maybe something is wrong with the module.

I’m simply requiring the Trello API Module. I’m not sure how it goes wrong.

local module = require(script.Parent)

I could be using a wrong version of the module, let me try an updated one.

You’re using this module I assume.

What does your current explorer window look like?
Here’s an example of what that is
image

Actually, I’m pretty sure I fixed it. I switched to a fixed version of Trello API and it worked. Thanks for your previous help! :slight_smile: