My Raycast won't detect what the part's Name is ? - If that makes sense.
local basePlate = game.Workspace.basePlate local rayOrigin = game.Workspace.Part.Position local rayDirection = Vector3.new(0,30,0) local raycastParams = RaycastParams.new() raycastParams.FilterDescendantsInstances = {basePlate} raycastParams.FilterType = Enum.RaycastFilterType.Blacklist local raycastResults = workspace:Raycast(rayOrigin, rayDirection, raycastParams) while wait(0.1) do local hit = raycastResults.Instance print(hit.Name) end
The error code that i'm getting : attempt to index nil with 'Instance'
A ray is a unitray by default meaning it only extends by one stud. You have to set it’s length by multiplying the direction vector by the length of the ray you want. For example do rayDirection * the length you want. Also wrap the print in an if statement so that it does not error out if it returns nil: if raycastResults then