Making a Detection script for Ban, Kick, Warn GUI

:wave: Hello there developers! :wave:

This is me DragonDarkVader i’m making a Ban, Warn, Kick Gui’s but unable to make one because i do not know how to script. If any of you want to give out scripts or Tutorials, It would be really appreciated!

The kick script is simple.

@SubtotalAnt8185 Has made a script to me to Kick people that are not admin with reasons.

local username  = script.Parent.Parent.Username
local reason = script.Parent.Parent.Reason
local Player = game:GetService("Players").LocalPlayer
local exepct = {"kdopdaux1803","4667Hp","LoukaTigre_ps3","Eddy0107","SubtotalAnt8185"}

local shorts = script.Parent.Parent["Username for short"]
local shortTemplate = shorts.Username:Clone()
shorts.Username:Destroy()

function updateUsernames()
	shorts:ClearAllChildren()
	for _, plr in pairs(game.Players:GetPlayers()) do
		local clone = shortTemplate:Clone()
		clone.Text = plr.Name
		clone.Parent = shorts
	end
end

local OpenUsernamePanel = script.Parent.Parent["OpenTheUsername for short"]

OpenUsernamePanel.Activated:Connect(updateUsernames)

local otherusersframe = script.Parent.Parent.Parent["Who do you want to kick ?"]
local otheruserstemplate = otherusersframe.Username1:Clone()
otherusersframe.Username1:Destroy()

script.Parent.Activated:Connect(function()
	if username.Text:gsub("%s", "") == "" then
		warn("You must supply a username before kicking.")
		return
	end
	local plrs = {}
	for _, obj in pairs(game.Players:GetPlayers()) do
		local allowKick = true
		for _,v in pairs(exepct) do
			if username.Text:lower()==v:lower() then
				warn("You tried to kick "..v..", but it's an exepction !")
				allowKick = false
			end
		end
		if obj.Name:lower():match(username.Text:lower()) and allowKick then
			table.insert(plrs, obj)
		end
	end
	if plrs[1] and not plrs[2] then
		username.Text = plrs[1].Name
		script.Parent.Parent.Parent.AreYouSure.Visible = true
		script.Parent.Parent.Visible = false
		--This is handled in the other frame
		--print("You kicked "..username.Text.." for "..((reason.Text~="" and reason.Text) or "an unknown reason given"))
		return
	elseif not plrs[1] then
		warn("There is no player named \""..username.Text.."\" in the server!")
		return
	end
	if plrs[2] then
		for _, child in pairs(otherusersframe:GetChildren()) do
			if child.Name == "Username1" then child:Destroy() end
		end
		for _, plr in pairs(plrs) do
			local clone = otheruserstemplate:Clone()
			clone.Text = plr.Name
			clone.Parent = otherusersframe
		end
		otherusersframe.Visible = true
		script.Parent.Parent.Visible = false
		return	
	end
end)

Can it show a GUI? Like a custom One

Like uhm…A Script detects a player being kicked or banned or warned. Instead of the Default Roblox UI. It shows a GUI Custom Made by me.

Like this Gui’s:



local username  = script.Parent.Parent.Username
local reason = script.Parent.Parent.Reason
local Player = game:GetService("Players").LocalPlayer
local exepct = {"kdopdaux1803","4667Hp","LoukaTigre_ps3","Eddy0107","SubtotalAnt8185"}

local shorts = script.Parent.Parent["Username for short"]
local shortTemplate = shorts.Username:Clone()
shorts.Username:Destroy()

function updateUsernames()
	shorts:ClearAllChildren()
	for _, plr in pairs(game.Players:GetPlayers()) do
		local clone = shortTemplate:Clone()
		clone.Text = plr.Name
		clone.Parent = shorts
	end
end

local OpenUsernamePanel = script.Parent.Parent["OpenTheUsername for short"]

OpenUsernamePanel.Activated:Connect(updateUsernames)

local otherusersframe = script.Parent.Parent.Parent["Who do you want to kick ?"]
local otheruserstemplate = otherusersframe.Username1:Clone()
otherusersframe.Username1:Destroy()

script.Parent.Activated:Connect(function()
	if username.Text:gsub("%s", "") == "" then
		warn("You must supply a username before kicking.")
		return
	end
	local plrs = {}
	for _, obj in pairs(game.Players:GetPlayers()) do
		local allowKick = true
		for _,v in pairs(exepct) do
			if username.Text:lower()==v:lower() then
				warn("You tried to kick "..v..", but it's an exepction !")
				allowKick = false
			end
		end
		if obj.Name:lower():match(username.Text:lower()) and allowKick then
			table.insert(plrs, obj)
		end
	end
	if reason.Text == "uwu" or "Uwu" or "UWu" or "UWU" or "uWu" or "uWU" or "uwU" or "UwU" then
		script.Parent.Parent.Parent.AreYouSure.Visible = false
		script.Parent.Parent.Parent.AreYouSure.Title.Text = "Are you sure to kick this person with a reason of "..reason.Text.." ?"
		script.Parent.Parent.Visible = false
	end
	if plrs[1] and not plrs[2] then
		username.Text = plrs[1].Name
		script.Parent.Parent.Parent.AreYouSure.Visible = true
		script.Parent.Parent.Visible = false
		--This is handled in the other frame
		--print("You kicked "..username.Text.." for "..((reason.Text~="" and reason.Text) or "an unknown reason given"))
		return
	elseif not plrs[1] then
		warn("There is no player named \""..username.Text.."\" in the server!")
		return
	end
	if plrs[2] then
		for _, child in pairs(otherusersframe:GetChildren()) do
			if child.Name == "Username1" then child:Destroy() end
		end
		for _, plr in pairs(plrs) do
			local clone = otheruserstemplate:Clone()
			clone.Text = plr.Name
			clone.Parent = otherusersframe
		end
		otherusersframe.Visible = true
		script.Parent.Parent.Visible = false
		return	
	end
end)

Where do i put it? In a script in ServerScriptService?

Yes do it on ServerScriptService, like I said before, on the 1st reply of your topic.

1 Like

How do i add the Name of the GUI i made? Named “Kicked” GUI

Kicked

Pick my model i decided to put on the 4th response !

It doesn’t work. I tried kicking myself using free admin commands. But it doesnt kick me

Normal.

local allowKick = true
for _,v in pairs(exepct) do
	if username.Text:lower()==v:lower() then
		warn("You tried to kick "..v..", but it's an exepction !")
		allowKick = false
	end
end

You see that allowKick is false if the admin is an exception, although you are an exception, you can’t be kicked until someone that is not an exception and he can be kicked.

1 Like