So I'm using this function to check if an enemy can see the player:
local Ray = Ray.new(NPCmodel:findFirstChild("Head").Position,(Player.Character.Head.Position-NPCmodel:findFirstChild("Head").Position).unit*250)
local ign = {EnemyFolder}
table.insert(ign,DeadFolder)
local hit,pos,norm = game.Workspace:FindPartOnRayWithIgnoreList(Ray,ign)
NPCmodel is the parent of the module this code is in, EnemyFolder is a folder, holding all the enemy models inside, DeadFolder is another folder, holding all things to be ignored by rays.
it gives me this: Unable to cast Dictionary to Ray. Which is fair enough, however the function to get to this function uses THE EXACT SAME CODE. I'm at a loss to understand what I'm doing wrong :( If anyone knows whats up, I'd really appreciate some help! :)

1 comment
lets hold the phone, not only did I just copy + past the wrong code, but I placed a number after the incorrect code... Fix this now.