i have this code here (supposed to visualize the raycast)
local rayOrigin = hrp.Position
local rayDirection = hrp.CFrame.lookVector * 1000
local raycastParams = RaycastParams.new()
raycastParams.FilterType = Enum.RaycastFilterType.Exclude
raycastParams.FilterDescendantsInstances = {char}
raycastParams.IgnoreWater = true
local raycastResult = workspace:Raycast(rayOrigin, rayDirection, raycastParams)
local function dobeam()
local distance = (rayOrigin - raycastResult.Position).Magnitude
local part = Instance.new("Part", workspace)
part.Anchored = true
part.CanCollide = false
part.Size = Vector3.new(0.1,0.1,distance)
part.CFrame = CFrame.lookAt(rayOrigin, rayDirection)*CFrame.new(0, 0, -rayDirection/2)
end
problem is i want it to be visualized regardless if it hits a part or not
(also when it visualizes the part ends in teh middle of the raycast)