Anti-Exploit Not Working

  1. What do you want to achieve?
    I want to try and get help debugging this anti-exploit script.

  2. What is the issue?
    The issue is it keeps breaking when I enter the game. This the error that keeps popping up.


    Also here is the code I used,

local Players = game:GetService("Players")

local LocalPlayer = Players.LocalPlayer

local Character = LocalPlayer.Character

repeat wait() until LocalPlayer
repeat wait() until LocalPlayer.Character

local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")

local Anti = script.Parent:WaitForChild("Securing")

-- Flying

HumanoidRootPart.ChildAdded:connect(function(Obj)
	if Obj:IsA("BodyPosition") or Obj:IsA("BodyVelocity") or Obj:IsA("BodyGyro")then
		Obj:Destroy()
		LocalPlayer:Kick("You've been caught trying to fly.")
	end
end)

-- No Humanoid
Character.ChildRemoved:connect(function(Obj)
	if Obj:IsA("Humanoid")then
		LocalPlayer:Kick("You've been caught trying to destroy your humanoid.")
	end
end)

while wait() do
	if script.Parent:FindFirstChild("Securing") == nil then
		LocalPlayer:Kick("You've been caught trying to disable the AntiExploit.")
	elseif Anti.Disabled then
		Anti.Disabled = false
	end
end
  1. What solutions have you tried so far?
    So far i’ve tried re writing the script a couple times to make sure that I didn’t misspell anything. I also rewrote the script at the bottom portion of the script.

Can I please have some help?

1 Like

Is this a serverscript or a localscript?

1 Like

I would assume it’s a localscript because most people make there anti-exploits with a localscript.

1 Like

Yeah it is a Local Script. It is not a serverscript.

1 Like

Where did you make and put the localscript? That could be the problem

I put the local script inside of Starter Player Scripts.

1 Like

From the errormessage from the screenshot it looks like you are trying to find a child something that isn’t an object (maybe a property or nil). It looks like on line 10 you changed it to WaitForChild, so I would check in the explorer to make sure that the HumanoidRootPart is in character.

1 Like

If you need further help, he put his local script code in the post.

You shouldn’t make anti-exploits on the client, exploiters can easly get around these. Trusting the client is usually a bad idea.

1 Like

You should put it to StarterCharacterScripts (as I remember like that)

3 Likes

Can you please explain this a little more please? I don’t quite understand what you’re talking about.

I would make a remote event (from client to server) that kicks the player on the server. Also, use the built-in parameter in the serverscript for the player (the first one).

FYI: Hackers can write their own localscript

1 Like

Why are you even trusting the front-end for anti-exploit? It’s their machine, they can disable the LocalScript if they want to. It’s like using JavaScript to check inputs, it can be easily disabled.

Also you should stop using wait as seen on some of your codes.

Most anti-exploits are back-end as front-end anti-exploit can be disabled easily.

2 Likes

Anti-exploits should be made on the server, not the client. Exploiters can modify the client and easily get around the client side anti-exploit.

2 Likes

I installed a system where if you try and disable the script it won’t allow you too. It will also kick you.

seriously an anti exploit with a localscript?

Exploiters can easily delete this script.

1 Like

How does that work? Is it on a localscript or serverscript?

It is on a local script as of right now.

It should be changed to a serverscript

1 Like

The hacker could just delete that localscript

If you do put it on a serverscript, won’t the server see that the localscript (anti exploit) is fine, while it is deleted or disabled on the client?

1 Like