Why are you passing a victim argument, then immediately assigning it to the value of findPlayer(message)? In the limited code you posted, reason is just whatever is being passed into the function, so if you did this:
01 | function commandTable.kick(message, victim, reason) |
02 | victim = findPlayer(message) |
03 | if victim and victim.Character then |
04 | victim:Kick( "[Kick]: You have been kicked from the game! Reason: " ..reason.. "." ) |
11 | commandTable.kick(message,victim,reason) |
"message" is likely a string, victim is most likely a Player object; reason can be many things, but it mostly makes sense if it's a string as well; whatever you pass through to the function will be the reason. If you want the player to give his own custom reason, example: /kick noobplayer123 trolling
You would have to use string manipulation to find the reason, but if you're already finding the commands from the .Chatted event, it shouldn't be much more difficult.