Anti Exploit Help/Feedback

Hi There
So I recently just started development of a server sided anti exploit/cheat to try and prevent some common exploits like fly, speed, jump, etc.

I just want to see your feedback with this system so that I can make it better.

Thanks.

Script - On ServerScriptService

local Players = game:GetService("Players")
local Admins = {
	1
}
function GenerateRandomName()
	return tostring(math.random())
end
function LoadServerAE(char)
	local RootPart = char:WaitForChild("HumanoidRootPart")
	local Humanoid = char:WaitForChild("Humanoid")
	RootPart:GetPropertyChangedSignal("CFrame"):Wait()

	local lastCF = RootPart.CFrame
	local PlayerOnGround = 0
	local lastPOGCFrame = RootPart.CFrame


	game:GetService("RunService").Heartbeat:Connect(function(step)

		local cf = RootPart.CFrame

		--Walk Speed Cheats
		local X_Z_Velocity = (cf.Position * Vector3.new(1, 0, 1) - lastCF.Position * Vector3.new(1, 0, 1)).Magnitude / step

		if X_Z_Velocity > Humanoid.WalkSpeed * 5 then
			RootPart.CFrame = lastCF
		end
		--Jump And Fly Cheats
		local FM = Humanoid.FloorMaterial
		if FM == Enum.Material.Air then
			local HumState = Humanoid:GetState()
			if HumState == Enum.HumanoidStateType.Freefall or HumState == Enum.HumanoidStateType.Landed or HumState == Enum.HumanoidStateType.Climbing then
				--No
			else
				PlayerOnGround = PlayerOnGround + 1
			end
		else
			PlayerOnGround = 0
			lastPOGCFrame = RootPart.CFrame
		end
		if PlayerOnGround >= 100 then
			PlayerOnGround = 0
			RootPart.CFrame = lastPOGCFrame
		end
		--No Clip Cheats
		RootPart.Touched:Connect(function(Part)
			if Part.CanCollide == false then
				Part.CanCollide = true
				RootPart.CFrame = lastCF
			end
		end)

		lastCF = RootPart.CFrame
	end)
end
function LoadClietAE(char)
	local Clone = script.LocalScript
	Clone.Name = GenerateRandomName()
	Clone.Parent = char
	Clone.Disabled = false
end
Players.PlayerAdded:Connect(function(plr)
	if table.find(Admins, plr.UserId) then
		print("Admin Usage Detected")
	else
		plr.CharacterAdded:Connect(function(char)
			LoadServerAE(char)
			LoadClietAE(char)
		end)
	end
end)
--Service Randomizer
--Makes it so that only game:GetService("SERVICE NAME") will work  in these services
--instead of game.SERVICE NAME
wait(5)
workspace.Name = GenerateRandomName()
game:GetService("Players").Name = GenerateRandomName()
game:GetService("Lighting").Name = GenerateRandomName()
game:GetService("ReplicatedFirst").Name = GenerateRandomName()
game:GetService("ReplicatedStorage").Name = GenerateRandomName()
game:GetService("StarterPlayer").StarterCharacterScripts.Name = GenerateRandomName()
game:GetService("StarterPlayer").StarterPlayerScripts.Name = GenerateRandomName()

LocalScript Parented on the Script With the disabled property to true

wait(1)-- wait's 1 second before hiding the script in nil
script.Parent = nil
while wait() do
	local Players = game:GetService("Players")
	local AllowedItems = game:GetService("StarterPack"):GetChildren()
	local RunService = game:GetService("RunService")
	local Player = Players.LocalPlayer
	local Character = Player.Character
	local PlayerUI = Player.PlayerGui
	local AllowedUI = {"BubbleChat","Chat","Freecam","GUI NAME HERE"}
	function Punish(obj)
		pcall(function()
			obj:Destroy()
		end)
	end
	function ScanGUIs()
		local UIs = PlayerUI:GetChildren()
		for i,GUI in pairs(UIs) do
			for x = 1, #AllowedUI do
				if GUI:IsA("ScreenGui") then
					if not table.find(AllowedUI, GUI.Name) then
						wait(2)
						Punish(GUI)
					end
				end
			end
		end
	end
	PlayerUI.ChildAdded:Connect(function()
		ScanGUIs()
	end)
end
function generateRandomName(len)
   len = len or 10
   local arrayofthing = {}
   for i = 1,len do
      table.insert(arrayofthing,utf8.char(math.random(33,126)))
   end
   return table.concat(arrayofthing)
end

because exploiters could do if tonumber on name, also randomizing service names is very inefficient and highly unrecommended.

also I recommend camelCase but it’s personal preference and up to you.

also dont use localscripts as their ez bypassed, handle it all in server also randomizing localscript name will not do anything, and parent = nil will make the script destroyed.

1 Like

my main ae detection is on the server while my personal detection for the gui’s and stuff is on the client. also thank you for the feedback. hopefully, I can make this better.