[SOLVED] The admin gets warned even though, the kick system is working [PATCHED]

I already have this:

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)

Ok then it’s simple enough, let me modify the code a bit to include your Admins table, and I’ll reply again with that code.

Wait, no, don’t change it, if you change it, it will broke.

No, it won’t be. Here you go.

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)

Nope, sorry, i’m not copying this, this is literally so freaking insane for me.

Try using this.

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)

What do you mean ?

I’m 99.97% sure this will not work because it does not have any :Kick thing…

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.

I can because the kick system works perfectly fine because of @IDoLua

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.

Same to this one:

Here’s the link of the topic: [SOLVED AT 50%] Username for short not cloning and the Admin being kicked as an exepction

And here’s the link of @SubtotalAnt8185’s post: [SOLVED AT 50%] Username for short not cloning and the Admin being kicked as an exepction - #44 by SubtotalAnt8185