Hey! I was wondering how to make a custom reason like: /kick roblox reason
code
function commandTable.kick(message, victim, reason) victim = findPlayer(message) if victim and victim.Character then victim:Kick("[Kick]: You have been kicked from the game! Reason: "..reason..".") end end
that doesnt work Any fix?
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:
function commandTable.kick(message, victim, reason) victim = findPlayer(message) if victim and victim.Character then victim:Kick("[Kick]: You have been kicked from the game! Reason: "..reason..".") end end --and then you call this function from somewhere 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.