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

It’s the same thing, but you switched the:

And:

Okay this is a trainwreck, first things first:

Here’s all you need for the Client side of it (LocalScript)

local username  = script.Parent.Parent.Username
local reason = script.Parent.Parent.Reason
local Player = game:GetService("Players").LocalPlayer

script.Parent.MouseButton1Click:Connect(function()
	if not game.Players:FindFirstChild(username.Text) then
		warn("You tried to kick "..username.Text.." but it's an invalid username !") 
		return
	end
	if game.Players:FindFirstChild(username.Text) then
		print("You kicked "..username.Text)
		game.ReplicatedStorage.KickPlayer:FireServer(username.Text, reason.Text)
		-- Removed the LocalPlayer kick, what were you even trying to accomplish there?
	end
end)

Now, if you would, please send your ServerScript that handles the “KickPlayer” RemoteEvent in ReplicatedStorage, if you don’t have one, I’ll make you one.

There’s a blank beteewn the “kick” and “but”.

So no, sorry.

I actually did not put a username in it…

Okay what are you talking about?

I need to know EXACTLY what you want to do.
You’re not giving me anymore info, you’re just outright denying the offer of assistance.
I don’t mean to be rude, but if you’re going to ask for help, you’ll have to put the effort in to give those who care to help info, and more importantly, a chance to help.

I forgot that i putted @elomala’s script…

And plus, it did not kicked me…

Try this version, it should fix the small detail you had concerned.

local username  = script.Parent.Parent.Username
local reason = script.Parent.Parent.Reason
local Player = game:GetService("Players").LocalPlayer

script.Parent.MouseButton1Click:Connect(function()
	if username.Text:gsub("%s", "") == "" then -- :gsub("%s", "") just ensures we do not count " " as a username
		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
		print("You kicked "..username.Text)
		game.ReplicatedStorage.KickPlayer:FireServer(username.Text, reason.Text)
		-- Removed the LocalPlayer kick, what were you even trying to accomplish there?
	end
end)

We will get down to the “Kicking” part of the script later, you should never kick on the Client, you need a server script, which as I said, we will get to soon.

Did not kicked…

Char limit

Added myself some lines:

local username  = script.Parent.Parent.Username
local reason = script.Parent.Parent.Reason
local Player = game:GetService("Players").LocalPlayer

script.Parent.MouseButton1Click:Connect(function()
	if username.Text:gsub("%s", "") == "" then -- :gsub("%s", "") just ensures we do not count " " as a username
		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
		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
end)

Thanks to @IDoLua to help me.
@elomala, Thanks to try to help me.
@cpguy5089, Thanks to try to help me.

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