Raycast not working for no reason

I have a blood system that uses raycast to detect when a blood drip touches something, then creates a pool of blood where it touches. For some reason it suddenly isnt working, and the ray isnt even being casted, I tried removing the blacklist but it still didnt work. Here is the code:

game:GetService("RunService").Heartbeat:Connect(function()
	local params = RaycastParams.new()
	params.FilterType = Enum.RaycastFilterType.Blacklist
	local t = {script.Parent, script.Parent.Parent}
	params.FilterDescendantsInstances = t
	local ray = workspace:Raycast(script.Parent.Position, Vector3.new(0,-1,0), params)
	if ray then
		print("ray has casted :)")
		if ray.Instance.Anchored == true and ray.Instance.CanCollide == true then
			local s = game.ReplicatedStorage.BloodPuddle:Clone()
			s.Parent = script.Parent.Parent
			s.Color = script.Parent.Color
			s.Position = ray.Position
			script.Parent:Destroy()
		end
	end
end)

This script is inside the blood drips, each one has this script inside of it.

Try multiplying the direction by an arbitrary number as the range

Like this?

local ray = workspace:Raycast(script.Parent.Position, Vector3.new(0,-1 * 10,0), params)

I guess. I wasn’t expecting you to multiply the y axis but it shouldn’t matter because its the only number that isn’t zero

I tried that and multiplying the vector3 itself and it did nothing

Works just fine for me.

game:GetService('RunService').Heartbeat:Connect(function(dt)
	local result = workspace:Raycast(script.Parent.Position, Vector3.new(0, -1, 0) * 10)
	
	if result then
		script.Parent.Attachment.WorldPosition = result.Position
	end
end)

I changed the parent of the bloodDrips to the character they are coming from, and now it works. I had them stored in a folder in workspace but why would that break it, I dont understand.

1 Like