[SOLVED] Username for short not cloning and the Admin being kicked as an exepction

I did the script differently…

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)

And it still kicked me out of the game !!1!!!

Guys, the kick system could be an impossible bug…

And the Username for short is possible but really hard to find it…

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)

Try this

1 Like

Bruh, it didn’t kicked, so no…

What do you want it to do, I thought you didn’t want to be kicked?

I want to make the expction to not be kicked…

That’s all i want for the kick button !

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)

I think this should work

2 Likes

Nope, still didn’t kicked…

A

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.

1 Like

Thank you @SubtotalAnt8185 !

I really appreciated !

Now for the hardest part (I guess), The Username for short not cloning…

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.

1 Like

It worked before, and here, it’s working too, so, i prefer the old one that you posted…

I did fix a few other things in the new one like the print statement. The new one also doesn’t require you to type out their whole username.

Alright, my script is good, now…

1 Like

I decided to read your script again.

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

Let me know if it helped or not!

That’s not the case, @SubtotalAnt8185 helped me…

You shorten the script alot more and that’s not i wanted…

Also, look at the issue, it’s solved !

Here:

Link to the guy who helped:

I still have the Username for short not cloning…

Please help me…

New script but the username won’t clone…

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)

Alright, it’s fixed, now we need @SubtotalAnt8185 to reply…

Smaller bandicam 2022-08-04 19-51-53-908

It’s fixed, I think. If there’s any issues, please DM me.