ray.Origin is not a valid member of RayCast

So I made a script thats suppose to show a raycast right?

But I get this error “ray.Origin is not a valid member of RayCast”
Can anyone tell me why?

-- show function
local function makeRayVisible(ray)
	local midPoint = ray.Origin + ray.Direction / 2
	
	local part = Instance.new('Part')
	part.Anchored = true
	
	part.CFrame = CFrame.new(midPoint, ray.Origin)
	part.Size = Vector3.new(1,1, ray.Direction.Magnitude)
	
	part.Parent = workspace
	
end


Also Im using this tutorial

You have forgot to return the part in the function.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.