This fires a ray from a brick and creates the parts called 'bOOm' when the ray hits an object.. the parts are created however when they are, the ray is obstructed by the bOOm parts. I was told to use the 'FindPartOnRayWithIgnoreList' so I tried but it's not working.
I'm probably using it incorrectly so please help.
This is what it looks like: Raycast
while wait() do
local bOOm = Instance.new("Part")
bOOm.BrickColor = BrickColor.new("Bright red")
bOOm.FormFactor = "Custom"
bOOm.Material = "Neon"
bOOm.Transparency = 0.25
bOOm.Anchored = false
bOOm.CanCollide = false
bOOm.Name = "bOOm"
local ray = Ray.new(script.Parent.CFrame.p, script.Parent.CFrame.lookVector * 300)
local part, endPoint = workspace:FindPartOnRayWithIgnoreList(ray, {script.Parent, bOOm}) -- Problem is here
bOOm.Parent = workspace
local beam = Instance.new("Part", workspace)
beam.BrickColor = BrickColor.new("Bright red")
beam.FormFactor = "Custom"
beam.Material = "Neon"
beam.Transparency = 0.25
beam.Anchored = true
beam.CanCollide = false
local distance = (script.Parent.CFrame.p - endPoint).magnitude
beam.Size = Vector3.new(0.3, 0.3, distance)
beam.CFrame = CFrame.new(script.Parent.CFrame.p, endPoint) * CFrame.new(0, 0, -distance / 2)
bOOm.Size = Vector3.new(1, 1, 1)
bOOm.CFrame = CFrame.new(endPoint)
print(part)
game:GetService("Debris"):AddItem(beam, 0.1)
game:GetService("Debris"):AddItem(bOOm, 0.4)
end

1 comment
The first error i see is in the Ray.new. After you put the origin position you must then take the new position and subtract it from the old position. Then put .unit * 300.