Answered by
5 years ago Edited 5 years ago
The issue was that since you're using the admin tutorial here, it has this line in the "ParseMessage" function. What is does is that it uses string.lower to the message, causing the entire thing to become lowercase. Because of this, the kick command processed the usernames as lowercase therefore not finding any players.
04 | local function ParseMessage(Player,Message) |
05 | local PrefixMatch = string.match(Message, "^" ..Prefix) |
08 | Message = string.gsub(Message,PrefixMatch, "" , 1 ) |
11 | for Argument in string.gmatch(Message, "[^%s]+" ) do |
12 | table.insert(Arguments,Argument) |
16 | local CommandName = Arguments [ 1 ] |
17 | table.remove(Arguments, 1 ) |
18 | local CommandFunc = Commands [ CommandName ] |
20 | if CommandFunc ~ = nil then |
21 | CommandFunc(Player,Arguments) |
26 | Commands.kick = function (Sender, Arguments) |
27 | local Message = table.concat(Arguments, " " ) |
28 | if (Arguments [ 1 ] = = nil ) then return end |
29 | local userPlayer = Arguments [ |
31 | local reason = Arguments [ 2 ] ; |
32 | if (Arguments [ 2 ] = = nil ) then |
33 | reason = "No reason provided." |
35 | local findPlayer = game:GetService( "Players" ):FindFirstChild(userPlayer) |
37 | findPlayer:Kick(reason) |
39 | warn( "Player not found." ) |
43 | game.Players.PlayerAdded:Connect( function (plr) |
44 | plr.Chatted:Connect( function (Message) |
45 | ParseMessage(plr,Message) |
I modified the code from the tutorial a little bit. Make sure to accept my answer if its right!