local Admins = {"kdopdaux1803","4667Hp"}
game.Players.PlayerAdded:connect(function(player)
for i, v in pairs(Admins) do
if player.Name == v then
script.AdminPanel:Clone().Parent = player:WaitForChild("PlayerGui")
end
end
end)
local Admins = {"kdopdaux1803","4667Hp"}
local Remote = game:GetService("ReplicatedStorage"):WaitForChild("KickPlayer")
local Players = game:GetService("Players")
Players.PlayerAdded:Connect(function(Player)
if table.find(Admins, Player.Name) then
script.AdminPanel:Clone().Parent = Player:WaitForChild("PlayerGui")
end
end)
Remote.OnServerEvent:Connect(function(Player, Username, Reason)
if not table.find(Admins, Player.Name) then Player:Kick("You are not an Admin!") return end
if Player.Name == Username then
Player:Kick(if Reason == "" then "No reason provided." else Reason)
return
end
if Players:FindFirstChild(Username) then
Players:FindFirstChild(Username):Kick(if Reason == "" then "No reason provided." else Reason)
else
warn(("The Player \"%s\" does not exist!"):format(Username))
end
end)
local username = script.Parent.Parent.Username
local reason = script.Parent.Parent.Reason
local Player = game:GetService("Players").LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
if game.Players:FindFirstChild(username.Text) then
print("Attempting to kick "..username.Text)
if reason.Text ~= "" or reason.Text ~= " " then
game.ReplicatedStorage.KickPlayer:FireServer(username.Text, reason.Text)
end
else
warn("You tried to kick "..username.Text.." but it's an invalid username !")
end
end)
You can’t use :Kick() on the client, unless you want it to be clientsided. If you do game.Players.LocalPlayer:Kick("") it’s just gonna kick yourself. Make a remote event and connect it to the kick event.
game.ReplicatedStorage.KickPlayer.OnServerEvent:Connect(function(Player, Target, Reason)
local targetPlayer = game.Players:FindFirstChild(Target)
if targetPlayer then
targetPlayer:Kick(Reason)
end
end)
Connect this with a server-script so it will work for all clients.
You cannot kick people locally, it will only work clientsided therefore, you need to make it serversided so it works for the person your trying to kick, and as for myself who has created various administration panels before you need to make it serversided for it to work.
Currently if you try to kick someone from the game, it will only work for your client rather than the whole entire server.