Alright so I’m having trouble. I can’t seem to raycast towards a player. I’m having trouble with this sample.
function canSeeILV(selfchar,lookfor,origin,direction)
local ray = Ray.new(origin,direction)
local partcell, v3pos = workspace:FindPartOnRay(ray,selfchar)
if partcell then
if partcell:IsDescendantOf(lookfor) then
return true
else
return false
end
end
return false
end
The direction variable is the position of the target’s HumanoidRootPart.
It’s called in a while wait() do loop so it should update the position. But all it seems to do is cast into a weird direction where I have to walk to the model’s corner to trigger it.