Okay so the basic code from the roblox wiki
local ray = Ray.new(player.Lightning.WorldPosition.WorldPosition,player.HumanoidRootPart.CFrame.lookVector.unit*100) local Part,Position = game.Workspace:FindPartOnRayWithIgnoreList(Ray,{player,game.Workspace.Noncollide})
I'm trying to make the raycast ignore a folder in workspace called "Noncollide" but the output says this "21:51:30.115 - Unable to cast Dictionary to Ray".
Does anyone know how to make the ray ignore multiple parts?
Firstly, you defined the Ray as ray
, and then used Ray
in the FindPartOnRayWithIgnoreList
function.
Secondly,you gotta define the ignore list using the GetChildren
function on workspace.Noncollide
.
local ray = Ray.new(player.Lightning.WorldPosition.WorldPosition,player.HumanoidRootPart.CFrame.lookVector.unit*100) local ignore = workspace.Noncollide:GetChildren(); table.insert(ignore,player) local Part,Position = game.Workspace:FindPartOnRayWithIgnoreList(ray,ignore)