I am making a beam script and the ray casting seems to be going through stuff it shouldn't.
local ignoreList = {mob, game.Workspace.IgnoreFolder}
local castTrack = mob.Humanoid:LoadAnimation(script.Cast)
castTrack:Play()
wait(.5)
local base = spellEffect()
-- spellEffect() returns an object that is where the beam should originate.
local spawnFrame = base.CFrame
wait(.5)
local ray = Ray.new(spawnFrame.p,(spawnFrame.p-plr.Character.Torso.Position).unit*50)
local part, position = workspace:FindPartOnRayWithIgnoreList(ray,ignoreList,false, true)
local distance = (spawnFrame.p - position).Magnitude
print(distance)
print(part)
the distance always returns 50 and part always returns nill Thank you

1 comment
there are no output errors btw