I'm making a script were when my AI detects a part in front of him, he jumps. Though i'm going to use raycast to do this, and i never used raycast, consequently making me not knowing exactly on how to use it. So this how i want my ray cast to look (of course i don't want the part).
Though i haven't figured it out on how to do it. But here was my attempt:
local rayStart = script.Parent.Torso.Position - Vector3.new(0,3,0)
local rayLook = (rayStart - script.Parent.Torso.CFrame.lookVector*Vector3.new(0,0,5)).unit
local ray, pos = Ray.new(rayStart,(rayLook-rayStart).unit)
local partOnRay = game.Workspace:FindPartOnRay(ray,script.Parent)
Note that this is working. Though the ray is looking downwards, not forwards.
