local kick_module = {}
local Players_1 = game:GetService(“Players”)
local PermsClone = require(game.ServerScriptService.CommandsMain.Config)
local function PartialName(PartialName)
local Players = Players_1:GetPlayers()
local FoundPlayer = nil
for i = 1, #Players do
local CurrentPlayer = Players[i]
if string.find(string.lower(CurrentPlayer.Name), string.lower(PartialName)) then
FoundPlayer = CurrentPlayer.Name
if not FoundPlayer then
FoundPlayer = CurrentPlayer
end
else
return FoundPlayer
end
end
end
local prefix = “:” – The Prefix ex :,!,/
local command_1 = “kick” – The command
local kickreason = "You have been kicked from the server by: " – Dont remove the space
kick_module.kickcmd = function ()
Players_1.PlayerAdded:Connect(function(PlayerWhoJoined)
PlayerWhoJoined.Chatted:Connect(function(Msg_Unlowered)
print(“Command Fired”)
local Msg_Lowered = Msg_Unlowered:lower(string)
local Args = Msg_Lowered:split(" ")
if Args[1] == prefix…command_1 then
print(prefix..command_1)
if PlayerWhoJoined:GetRankInGroup(PermsClone.GroupID) >= PermsClone.MinAdminRank then
print("Player is min rank.")
local NameOfPlayerToKick = Args[2]
local PlayerToKick = game.Players:FindFirstChild(PartialName(NameOfPlayerToKick))
if PlayerToKick == PlayerWhoJoined then
print(PlayerToKick)
game:GetService("ReplicatedStorage").CommandRemotes.NotifyClients:FireClient(PlayerToKick,"Uh oh...","You can't kick yourself!")
return nil
elseif PlayerToKick.Name ~= PlayerWhoJoined.Name then
PlayerToKick:Kick(kickreason..PlayerWhoJoined)
end
end
end
end)
end)
end
return kick_module
Hello, my kick command errors with Argument Missing or nil on line 44