local username = script.Parent.Parent.Username
local reason = script.Parent.Parent.Reason
local Player = game:GetService("Players").LocalPlayer
local exepct = {"kdopdaux1803","4667Hp","LoukaTigre_ps3"}
script.Parent.MouseButton1Click:Connect(function()
if username.Text:gsub("%s", "") == "" then
warn("You must supply a username before kicking.")
return
end
if not game.Players:FindFirstChild(username.Text) then
warn("There is no Player named \""..username.Text.."\" in the server!")
return
end
game.Players.PlayerAdded:connect(function(player)
for i, v in pairs(exepct) do
if player.Name == v then
-- Add anything in here !
end
end
end)
if game.Players:FindFirstChild(username.Text) then
print("You kicked "..username.Text.." for "..reason.Text or "an unknow reason given")
game.ReplicatedStorage.KickPlayer:FireServer(username.Text, reason.Text)
game.Players.LocalPlayer:Kick(reason.Text)
if reason.Text == "" then
local victim = game.Players:FindFirstChild(username.Text)
if victim then victim:Kick("Unknown reason given.") end
else
local victim = game.Players:FindFirstChild(username.Text)
if victim then victim:Kick(reason.Text) end
end
end
end)
local username = script.Parent.Parent.Username
local reason = script.Parent.Parent.Reason
local Player = game:GetService("Players").LocalPlayer
local exepct = {"kdopdaux1803","4667Hp","LoukaTigre_ps3"}
script.Parent.MouseButton1Click:Connect(function()
if username.Text:gsub("%s", "") == "" then
warn("You must supply a username before kicking.")
return
end
if not game.Players:FindFirstChild(username.Text) then
warn("There is no Player named \""..username.Text.."\" in the server!")
return
end
game.Players.PlayerAdded:connect(function(player)
for i, v in pairs(exepct) do
if player.Name == v then
-- Add anything in here !
end
end
end)
if game.Players:FindFirstChild(username.Text) then
print("You kicked "..username.Text.." for "..reason.Text or "an unknow reason given")
if reason.Text == "" then
local victim = game.Players:FindFirstChild(username.Text)
if victim then game:GetService("ReplicatedStorage").KickPlayer:FireServer(victim, "An unknown reason given") end
else
local victim = game.Players:FindFirstChild(username.Text)
if victim then game:GetService("ReplicatedStorage").KickPlayer:FireServer(victim, reason.Text) end
end
end
end)
local username = script.Parent.Parent.Username
local reason = script.Parent.Parent.Reason
local Player = game:GetService("Players").LocalPlayer
local exepct = {"kdopdaux1803","4667Hp","LoukaTigre_ps3"}
script.Parent.MouseButton1Click:Connect(function()
if username.Text:gsub("%s", "") == "" then
warn("You must supply a username before kicking.")
return
end
if not game.Players:FindFirstChild(username.Text) then
warn("There is no Player named \""..username.Text.."\" in the server!")
return
end
if game.Players:FindFirstChild(username.Text) then
for _,v in pairs(exepct) do
if username.Text == v then
return
end
end
print("You kicked "..username.Text.." for "..reason.Text or "an unknow reason given")
if reason.Text == "" then
local victim = game.Players:FindFirstChild(username.Text)
if victim then game:GetService("ReplicatedStorage").KickPlayer:FireServer(victim, "An unknown reason given") end
else
local victim = game.Players:FindFirstChild(username.Text)
if victim then game:GetService("ReplicatedStorage").KickPlayer:FireServer(victim, reason.Text) end
end
end
end)
local username = script.Parent.Parent.Username
local reason = script.Parent.Parent.Reason
local Player = game:GetService("Players").LocalPlayer
local exepct = {"kdopdaux1803","4667Hp","LoukaTigre_ps3"}
script.Parent.MouseButton1Click:Connect(function()
if username.Text:gsub("%s", "") == "" then
warn("You must supply a username before kicking.")
return
end
if not game.Players:FindFirstChild(username.Text) then
warn("There is no Player named \""..username.Text.."\" in the server!")
return
end
if game.Players:FindFirstChild(username.Text) then
for _,v in pairs(exepct) do
if username.Text:lower():match(v:lower()) then
print("Exception for "..v)
return
end
end
print("You kicked "..username.Text.." for "..reason.Text or "an unknown reason given")
if reason.Text == "" then
local victim = game.Players:FindFirstChild(username.Text)
if victim then game:GetService("ReplicatedStorage").KickPlayer:FireServer(victim, "An unknown reason given") end
else
local victim = game.Players:FindFirstChild(username.Text)
if victim then game:GetService("ReplicatedStorage").KickPlayer:FireServer(victim, reason.Text) end
end
end
end)
Adding on to that, I understand what you mean by “username for short”, so this might help.
I’m not exactly sure what you meant by that, but I’ll do my best to help.
local username = script.Parent.Parent.Username
local reason = script.Parent.Parent.Reason
local Player = game:GetService("Players").LocalPlayer
local exepct = {"kdopdaux1803","4667Hp","LoukaTigre_ps3"}
script.Parent.Activated:Connect(function()
if username.Text:gsub("%s", "") == "" then
warn("You must supply a username before kicking.")
return
end
if not game.Players:FindFirstChild(username.Text) then
warn("There is no Player named \""..username.Text.."\" in the server!")
return
end
local plr
for _, obj in pairs(game.Players:GetPlayers()) do
if obj.Name:lower():match(username.Text:lower()) then
plr = obj
break
end
end
if plr then
for _,v in pairs(exepct) do
if username.Text:lower():match(v:lower()) then
print("Exception for "..v)
return
end
end
print("You kicked "..username.Text.." for "..(reason.Text~="" and reason.Text) or "an unknown reason given")
if reason.Text == "" then
game:GetService("ReplicatedStorage").KickPlayer:FireServer(plr, "An unknown reason given")
else
game:GetService("ReplicatedStorage").KickPlayer:FireServer(plr, reason.Text)
end
end
end)
I did this before when developing a very early version of BaseAdmin, but there might still be a few issues with the code. It should work, though.
When you’re kicking the player, you still have your LocalPlayer.Kick() from possible testing.
If you don’t want the player kicking to get kicked, replace this:
if game.Players:FindFirstChild(username.Text) then
print("You kicked "..username.Text)
game.ReplicatedStorage.KickPlayer:FireServer(username.Text, reason.Text)
game.Players.LocalPlayer:Kick(reason.Text)
if reason.Text == "" then
game.Players.LocalPlayer:Kick("Unknow reason given.")
else
game.Players.LocalPlayer:Kick(reason.Text)
end
end
…with this:
if game.Players:FindFirstChild(username.Text) then
print("You kicked "..username.Text)
game.ReplicatedStorage.KickPlayer:FireServer(username.Text, reason.Text)
end
local plr = game.Players
local plrname = plr.Name
local button = script.Parent
local buttonUSERNAME = button.Parent.Parent.Username
plr.PlayerAdded:Connect(function()
plr.Name = button:Clone(plrname)
script.Parent.Text = plrname
end)
script.Parent.MouseButton1Click:Connect(function()
if script.Parent.Parent.Parent.Username.Text == "" then
script.Parent.Name = script.Parent.Parent.Parent.Username.Text
end
end)