Raycast is hitting things it shouldnt hit

SOOOOOOOOOOOO
basicly i made a bazier thingy and it sends a raycast every time to look if something is in the way…

the thing is… it detects the part if its on the right even if its studs away and doesnt detect it on the left even if its exactly between the 2 part… someone knows how to fix that? pls… I cant do that anymore… ahhhhhh…

local p0 = workspace.P.P0
local p1 = workspace.P.P1
local p2 = workspace.P.P2

local ts = game:GetService("TweenService")

function quadBezier(t, p0, p1, p2)
	return (1 - t)^2 * p0 + 2 * (1 - t) * t * p1 + t^2 * p2
end

local timee = 0.05

local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Exclude
params:AddToFilter(workspace.P:GetChildren())

while true do
	local folder = Instance.new("Folder",workspace)
	
	local splatter = game.ReplicatedStorage.bloodSplatter:Clone()
	splatter.CFrame = CFrame.new(quadBezier(0, p0.Position, p1.Position, p2.Position))
	splatter.Parent = folder
	params:AddToFilter(splatter)
	
	for i = 0,1,.1 do
		local quadBazier0 = CFrame.new(quadBezier(i - 1, p0.Position, p1.Position, p2.Position)) --current position
		local quadBazier1 = CFrame.new(quadBezier(i, p0.Position, p1.Position, p2.Position)) --next position
		
		local timee = math.abs((quadBazier0.Position - quadBazier1.Position).Magnitude) / 150
		local tweenpos = quadBazier1.Position
		
		local rcresult = workspace:Raycast(quadBazier1.Position,quadBazier0.Position-quadBazier1.Position,params) --the raycast which gets send between the current position and the new one
		if rcresult then 
			print(rcresult.Instance) --if it hits something it prints it
			timee = math.abs((quadBazier0.Position - rcresult.Position).Magnitude) / 150
			tweenpos = rcresult.Position
			break --and breaks the loop
		end
		
		local Oart = Instance.new("Part") --red part for showcase
		Oart.Color = Color3.new(1, 0, 0.0156863)
		Oart.Anchored = true
		Oart.Material = Enum.Material.Neon
		Oart.Size = Vector3.new(.1,.1,.1)
		Oart.CFrame = quadBazier1
		Oart.Transparency = 1
		Oart.Parent = folder
		params:AddToFilter(Oart)
		
		ts:Create(splatter,TweenInfo.new(timee),{Position = tweenpos}):Play() --tween
		task.wait(timee- 0.03)
	end
	
	wait(0.5)
	folder:Destroy()
end
External Media

bro why cant it just show the video

just disable CanQuery of what the raycast is not supposed to hit, should be the easiest solution (i haven’t watched the video)

nope it was soemthign with the raycast but I fixed it still thx