Anti-Noclip raycast help

Hello! I’m having an issue where my code works, but is not giving the intended result and is still printing that there is something there when there is nothing!

Here’s a video on it:

Here’s the code:

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

local Part = Instance.new("Part")
Part.Name = "NoClipDetector"
Part.Size = Vector3.new(0.05, 0.05, 0.05)
Part.CanCollide = false
Part.Transparency = 0
Part.Anchored = true
Part.Parent = game.ServerStorage

Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(Character)
		local Cycle = false
		local Part1
		local Part2
		RunService.Heartbeat:Connect(function()
			if Cycle == false then
				Part1 = Part:Clone()
				Part1.Position = Character.HumanoidRootPart.Position
				Part1.Name = "Part1"
				Part1.Parent = game.Workspace.Trackers
				Cycle = true
			else
				Part2 = Part:Clone()
				Part2.Position = Character.HumanoidRootPart.Position
				Part2.Name = "Part2"
				Part2.Parent = game.Workspace.Trackers
				local raycastParams = RaycastParams.new()
				raycastParams.FilterDescendantsInstances = {Part1, Part2}
				raycastParams.FilterType = Enum.RaycastFilterType.Blacklist
				local StartPosition = Part.Position
				local RayVector = Part1.Position - Part.Position
				local Raycast = workspace:Raycast(StartPosition, RayVector, raycastParams)
				if Raycast then
					local Part3 = Raycast.Instance
					if not Part3.Parent:FindFirstChild("Humanoid") then
						Part3:Destory()
					end
				end
				Part1:Destroy()
				Part2:Destroy()
				Cycle = false
			end
		end)
	end)
end)

What it basically does (I hope lol) is create 1 part on one frame and another part on the other. On the second frame it’ll raycast between them and if it’s found anything that’s not a player it’ll determine it as no-clipping. However, it’s still thinking it is hitting something when it isn’t, a massive issue for accuracy! Any help is appreciated! Thank you for reading!

I haven’t been able to solve my issue but i’ve managed to create a new one by looking at this: Any Thoughts on my Anti Noclip Raycast?

Great, you don’t need parts for anti noclip, plus just simple CFrame.

yeah my method was very overly complex, i’m glad I’m now using a different way