A different noclip detection method

I recently found a new method of detecting noclip which might possibly be better than the original (raycast from last position to the newest position), this method doesn’t false flag when increasing the wait time between checks and is fairly simple too, this method works by creating a part within the character which is smaller than the player Torso (to avoid false flags) and every x amount of time it’ll get all the parts touching it excluding the parts within the Player’s character and other Players’s characters then it’ll raycast to the touching parts and if the raycast returns nil then they must be noclipping due to raycasting needing a part face to intersect with.

(it is serverside)
Here is the interesting method:

local Players = game:GetService("Players")
local NoclipPart

local function CreatePart(Character, RootPart, Humanoid) -- function to create NoclipPart
	local Connections = {}
	local NoclipPart = Instance.new("Part")
	NoclipPart.Size = Vector3.new(1.5,1.9,.8) -- set the best possible size without false flags
	NoclipPart.CanCollide = true -- cancollide must be true otherwise it won't work
	NoclipPart.Name = math.random(1, 9999)
	NoclipPart.Parent = Character
	local Weld = Instance.new("Weld") -- a weld so the Part stays attached to the RootPart
	Weld.Part0 = NoclipPart
	Weld.Part1 = RootPart
	Weld.Name = math.random(1, 9999)
	Weld.Parent = NoclipPart
	
	NoclipPart.Destroying:Connect(function() -- if RejectCharacterDeletions is set to false this'll make sure the part isn't just destroyed
		if Humanoid and Humanoid.Health > 0 then -- checks to make sure the Player hasn't died
			NoclipPart = CreatePart(Character, RootPart) -- if the player hasn't died then recreate the part
		else
			for _,connection in pairs(Connections) do -- loop through all connections and disconnect them
				connection:Disconnect()
				connection = nil
			end
		end
	end)
	
	Weld.Destroying:Connect(function()
		if Humanoid.Health and Humanoid.Health > 0 then
			if Humanoid and Humanoid.Health > 0 then -- checks to make sure the Player hasn't died
				NoclipPart:Destroy()
				NoclipPart = CreatePart(Character, RootPart) -- if the player hasn't died then recreate the part
			else
				for _,connection in pairs(Connections) do
					connection:Disconnect()
					connection = nil
				end
			end
		end
	end)
	
	return NoclipPart
end

Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		local Humanoid = Character:WaitForChild("Humanoid")
		local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
		NoclipPart = CreatePart(Character, HumanoidRootPart)
		
		while true do
			if Humanoid and Humanoid.Health > 0 then -- check to make sure the player hasn't died
				for _,Part in pairs(NoclipPart:GetTouchingParts()) do -- loop through all parts touching the NoclipPart
					if Part:IsA("Part") and Part.Parent ~= Character and Part.CanCollide == true and not Part.Parent:FindFirstChild("Humanoid") then  -- checks to stop false flags
						local Origin = NoclipPart.Position
						local Direction = Part.Position
						
						local RayParams = RaycastParams.new()
						RayParams.FilterDescendantsInstances = {Character}
						RayParams.FilterType = Enum.RaycastFilterType.Exclude -- filter out parts within the Player's Character
						
						local RayResults = workspace:Raycast(Origin, Direction, RayParams) -- raycast from the NoclipPart to the touching Part
						
						if not RayResults then -- if the raycast returned nil then they must be inside the part because the raycast found no faces to intersect with
							Humanoid.Health = 0 -- punish the player however you please
						end
					end
				end
			else
				break -- break out of the loop if the player has died
			end
			task.wait() -- this can be changed but teleport through parts won't be detected anymore
		end
	end)
end)
11 Likes

uh thanks for your method ig for what will players use this?

it’ll detect explotiers noclipping

oh nice its an anti cheat system nice

I like this method, I guess it would take in an effort to cache the part that is the brain to validate noclipping checks instead of creating it every time the character dies.

On sharp edges you can shift lock and walk into them and will trigger the anti-cheat

You should be able to just shrink the noclip part size and that’ll fix it

1 Like

Looks decent, one thing I would recommend though is optimizing this by creating the RayParams outside the loop so you can reuse it (and optionally using :GenerateGUID for the part names).

Unrelated but a good size for the NoclipPart is RootPart.Size * 0.5 in my testing.

Good method, but I’ve heard GetTouchingParts wasn’t very efficient. You should use .Touched instead since it’s far more efficient.

getting parts in the humanoidrootpart using getpartsboundinbox is a way better method for anyone reading

--simple noclip
local Overlap = OverlapParams.new();
Overlap.FilterType = Enum.RaycastFilterType.Exclude
Overlap.FilterDescendantsInstances = {Path.To.Instance} -- add all CanCollide disabled parts or anything else you don't wish to check here! 

local Players = game:GetService("Players")

while task.wait(2.5) do
	for _, Player in pairs(Players:GetPlayers()) do
		if Player.Character then
			local HumanoidRootPart = Player.Character:WaitForChild("HumanoidRootPart")
			local Parts = workspace:GetPartBoundsInBox(HumanoidRootPart.CFrame, HumanoidRootPart.Size / 3, Overlap);
			
			if (#Parts > 0) then
				print(Player.Name, " has been caught noclipping!") -- add your own detections here
			end
		end
	end
end

this is untested but you get the idea

The humanoidrootpart would false flag when I tried so you have to make a smaller part

it wouldn’t, i use the same method in my game and have not false flagged yet.

also just make the punishment rubberbanding and false flag wouldn’t do much anyeways