I want my Raycast Beam to detect nil objects instead of detecting non nil objects only.
Right now the beam only appears when the ray hits parts, but when it hits the sky nothing appears.
How can I make it so it also appears in the sky?
I’ve looked around on the forum but nothing answers my question.
This is my code:
local bullet_hole = ss.Hole:Clone()
local bullet = ss.Bullet:Clone()
local beam = ss.GunVFX:WaitForChild("Beam"):Clone()
local shootPart = a.Handle.Muzzle
local shootPartPos = shootPart.WorldPosition
local ignoreList = {char,bullet_hole,bullet}
local params = RaycastParams.new()
params.FilterDescendantsInstances = ignoreList
params.FilterType = Enum.RaycastFilterType.Blacklist
local spread = a.Info.Spread.Value / 70 * (humrp.Velocity).Magnitude + 0.25
local dir = RandomVectorOffset((b.p - shootPartPos).Unit, math.rad(spread))
local ray = Ray.new(shootPartPos, dir * a.Info.Range.Value)
local part, pos, normal = game.Workspace:FindPartOnRayWithIgnoreList(ray,ignoreList,false,true)
local distance = (shootPartPos-pos).Magnitude
coroutine.wrap(function()
for i = 0, 1, 0.2 do
beam.Transparency = NumberSequence.new(i,1)
wait()
end
beam:Destroy()
bullet:Destroy()
end)()
bullet.CFrame = CFrame.new(shootPartPos)
bullet.Parent = game.Workspace
beam.Attachment0 = bullet.Attachment
beam.Attachment1 = bullet_hole.Attachment
beam.Parent = bullet
local firePitches = {
1.1,
1,
0.95,
0.975,
1.15,
1.2
}
bullet_hole.Parent = game.Workspace
bullet_hole.CFrame = CFrame.new(pos,pos+normal)