Anti Exploit Script not fully working

Trying to add an Anti exploit to slow down/prevent exploiters in my game, I say “slow down/prevent” as this script is only a LocalScript so It’s very easy to bypass but I am not worried about that as this script is to slow down exploiters.

(I’m not a scripter I know very very little about scripting)

All the script works except for the anti btools script, which works IF it’s in a localscript by itself but it won’t work if it’s in a localscript with all of the other scripts in it.

-- Anti Fly
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
repeat wait() until LocalPlayer.Character
repeat wait() until LocalPlayer:FindFirstChild("Backpack")
local Character = LocalPlayer.Character
local Backpack = LocalPlayer:WaitForChild("Backpack")
local Anti = script.Parent
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
HumanoidRootPart.ChildAdded:connect(function(obj)
	if obj:IsA("BodyPosition") or obj:IsA("BodyVelocity") or obj:IsA("BodyGyro") then
		obj:Destroy()
		LocalPlayer:Kick("You have been kicked for use of exploits that gives you ability to fly.")
	end
end)



-- Humanoid Properties
while true do
	wait()
	if script.Parent:FindFirstChild("Humanoid").WalkSpeed > 17 then
		game.Players.LocalPlayer:Kick("You have been kicked for use of exploits that change your walkspeed.")
	end

	if script.Parent:FindFirstChild("Humanoid").JumpPower > 51 then
		game.Players.LocalPlayer:Kick("You have been kicked for use of exploits that change your jump power.")
	end

	if script.Parent:FindFirstChild("Humanoid").Health > 101 then
		game.Players.LocalPlayer:Kick("You have been kicked for use of exploits that change your health.")
	end

	if script.Parent:FindFirstChild("Humanoid").MaxHealth > 101 then
		game.Players.LocalPlayer:Kick("You have been kicked for use of exploits that change your health.")
	end

	if script.Parent:FindFirstChild("Humanoid").HipHeight > 5 then
		game.Players.LocalPlayer:Kick("You have been kicked for use of exploits that change your hip height.")
	end

	if script.Parent:FindFirstChild("Humanoid").MaxSlopeAngle > 90 then
		game.Players.LocalPlayer:Kick("You have been kicked for use of exploits that change your max slope angle.")
	end
end



-- Anti Btools
game:GetService("Players").LocalPlayer:WaitForChild("Backpack").ChildAdded:connect(function(Obj)
	if Obj:IsA("HopperBin") then
		print("Btools")
		game:GetService("Players").LocalPlayer:kick("You have been kicked for use of exploits that gave you btools.")
	end
end)
1 Like

You might wanna move the btools code above the while true do loop. I couldn’t really explain why, but I am pretty sure the loop just pauses the thread.

I also would recommand you use a Server Script instead of a LocalScript, as Local Scripts can easily be modified/deleted/bypassed by exploiters.


-- Anti Fly
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
repeat wait() until LocalPlayer.Character
repeat wait() until LocalPlayer:FindFirstChild("Backpack")
local Character = LocalPlayer.Character
local Backpack = LocalPlayer:WaitForChild("Backpack")
local Anti = script.Parent
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
HumanoidRootPart.ChildAdded:connect(function(obj)
	if obj:IsA("BodyPosition") or obj:IsA("BodyVelocity") or obj:IsA("BodyGyro") then
		obj:Destroy()
		LocalPlayer:Kick("You have been kicked for use of exploits that gives you ability to fly.")
	end
end)

-- Anti Btools
game:GetService("Players").LocalPlayer:WaitForChild("Backpack").ChildAdded:connect(function(Obj)
	if Obj:IsA("HopperBin") then
		print("Btools")
		game:GetService("Players").LocalPlayer:kick("You have been kicked for use of exploits that gave you btools.")
	end
end)

-- Humanoid Properties
while true do
	wait()
	if script.Parent:FindFirstChild("Humanoid").WalkSpeed > 17 then
		game.Players.LocalPlayer:Kick("You have been kicked for use of exploits that change your walkspeed.")
	end

	if script.Parent:FindFirstChild("Humanoid").JumpPower > 51 then
		game.Players.LocalPlayer:Kick("You have been kicked for use of exploits that change your jump power.")
	end

	if script.Parent:FindFirstChild("Humanoid").Health > 101 then
		game.Players.LocalPlayer:Kick("You have been kicked for use of exploits that change your health.")
	end

	if script.Parent:FindFirstChild("Humanoid").MaxHealth > 101 then
		game.Players.LocalPlayer:Kick("You have been kicked for use of exploits that change your health.")
	end

	if script.Parent:FindFirstChild("Humanoid").HipHeight > 5 then
		game.Players.LocalPlayer:Kick("You have been kicked for use of exploits that change your hip height.")
	end

	if script.Parent:FindFirstChild("Humanoid").MaxSlopeAngle > 90 then
		game.Players.LocalPlayer:Kick("You have been kicked for use of exploits that change your max slope angle.")
	end
end
3 Likes

Thank you for helping me fix the issue, everything seems to be working well.

I know Local Scripts aren’t as good as a ServerScripts but If an exploiter really wants to exploit in my game they will find a way around a ServerScript too. ServerScripts are also much more complicated to script than a LocalScript.

True, but trust me, majority of peoples who exploits has absolutely no idea of what they are doing. The Server Script can try to maintain them for a while or completely stop them if your script is good.