game.Players.PlayerAdded:Connect(function(plr)
local rep = game:GetService("ReplicatedStorage")
local rem = rep:WaitForChild("RemoteEvent")
local rem2 = rep:WaitForChild("rem2")
if plr.UserId == 3362150894 then
rem:FireClient(plr)
wait(6.1)
end
rem2.OnServerEvent:Connect(function(plr)
plr.Chatted:Connect(function(msg)
local plrtokick = "kick "..plr.Name
if msg == plrtokick then
plrtokick:kick()
end
end)
end)
end)
game.Players.PlayerAdded:Connect(function(plr)
local rep = game:GetService("ReplicatedStorage")
local rem = rep:WaitForChild("RemoteEvent")
local rem2 = rep:WaitForChild("rem2")
if plr.UserId == 3362150894 then
rem:FireClient(plr)
wait(6.1)
end
rem2.OnServerEvent:Connect(function(plr)
plr.Chatted:Connect(function(msg)
local plrtokick = game.Players:FindFirstChild(plr.Name)
if msg == "kick"..plrtokick then
print("worka")
plrtokick:kick()
end
end)
end)
end)
local players = game:GetService("Players")
local whitelisted = {1, 2, 3} --Add whitelisted IDs here.
players.PlayerAdded:Connect(function(player)
player.Chatted:Connect(function(message)
local splitMessage = message:split(" ")
if splitMessage[1]:lower():match("^:kick") then
if table.find(whitelisted, player.UserId) then
local chattedPlayers = {}
for _, player in ipairs(players:GetPlayers()) do
if player.Name:lower():match("^"..splitMessage[2]:lower()) then
table.insert(chattedPlayers, player)
end
if #chattedPlayers == 1 then
local chattedPlayer = chattedPlayers[1]
chattedPlayer:Kick(splitMessage[3])
end
end
end
end
end)
end)
I shouldn’t spoon feed but here you go. The command is :kick {PlayerNameHere} {OptionalMessageHere}. You can whitelist players that can use the command by inserting their ID into the array named “whitelisted” at the top of the code snippet.