Need help with critical bug in my Anti-Cheat system

Hello developers.

I am working on an anti-cheat system, but I found a critical bug in my system that I don’t have any clue on how to fix.

I have three main file structures to my anti-cheat:
ReplicatedStorage.ACEvents - Houses all the events to my anti-cheat (client and server both)
image

ServerScriptService.AntiCheat - The main code to my system.
image

StarterCharacterScripts - Several scripts that don’t have an effect on the system, just simple independent processes, except for one, AC_Client.
image

AC_Client manages all of the client-side stuff for the anti-cheat, including making sure that all the scripts are present on the client side. Since they are client scripts, the client can delete them and the sever (AnticheatMaster) sees they are still there, even though they are not.

Ensurer communicates to AC_Client via the CheckScriptPresence RemoteFunction in ACEvents to make sure the scripts are present on the client side.

while true do
	wait(5)

	for _, Player in pairs(game.Players:GetPlayers()) do
		local Character = workspace:FindFirstChild(Player.Name)
		local PresentScripts = ReplicatedStorage.ACEvents.CheckScriptPresence:InvokeClient(Player)
		
		local MissingScripts = 0
		
		if Character then
			local Scripts = script:GetChildren()

			for _, Script in pairs(Scripts) do
				local ScriptName = Script.Name

				if not table.find(PresentScripts, ScriptName) then
					local ScriptClone = Script:Clone()
					ScriptClone.Parent = Character
					ScriptClone.Enabled = true
					MissingScripts += 1
				end
			end
		end
	end
end

If the client is to delete AC_Client during one of the 5 second waiting periods, the script fails and the Anti-Cheat system is no longer running, leaving this error message behind:
image

I know I could simply wrap it in a pcall() and call it a day, but I want my system to be fully functional. Is there any way I can fix this?

Side note: I know Byfron exists, but it hardly does its job, I still see exploiters all the time.

Thank you in advance,
Anticitizen One

I’m not quite sure what the point is in programming a system such as this. If the player modifies their client, thats on them. You should focus on protecting client to server RemoteEvents and/or RemoteFunctions to prevent exploiters abusing these.

Equally, protecting areas of your game that you deem “restricted” (eg somewhere only people with a gamepass can enter) is a much more effective way at combating exploiters. Have server-side scripts check for unusual/wrong behaviour that wouldn’t be occuring if there was no exploiting in the first place.

Most exploiters will not waste their time deleting local scripts unless it really serves a massive benefit (which nine times out of ten it doesn’t).

This isn’t an effective method at deterring exploiters an in the reality of things, is a very easy system to bypass and break.

1 Like