Raycasting script works but creating errors

local Service = game:GetService("RunService")
Service.Stepped:connect(function()
	local H = 4
	local Points = script.Parent:GetChildren()
	for i = 1,#Points do
		if Points[i] ~= script then
			local ray = Ray.new(Points[i].Position,Vector3.new(0,-H,0))
			local Part,P = workspace:FindPartOnRayWithIgnoreList(ray,script.Parent.Parent.Wheels:GetDescendants())
			local Wheel = script.Parent.Parent.Wheels:FindFirstChild(Points[i].Name)
			if Wheel then
				Wheel.Position = P + Vector3.new(0,Wheel.Size.Y/2,0)
			end	
		end
	end
end)

Error: Position is not a valid member of NumberValue
Note: Error line:7

local ray = Ray.new(Points[i].Position,Vector3.new(0,-H,0))

I followed what others did, but It gives me errors. I don’t know why.

1 Like

It’s recognizing a NumberValue object under the parent of the script object. Add that to your ignore conditional statement on line 6.

1 Like

Oh my! It’s my fault. I forget that there is a NumberValue. Thanks!

1 Like