raycast
Functions to cast a ray for roblox objects.
Issues:
This is currently in WIP, this means the feature can be buggy/non functional at times.
The current raycasting system is limited to detecting parts and does not support terrain or character interactions.
Max distance the ray can reach is
6000studs
table -> result_table
hit
bool
true if the ray hit an object, false otherwise.
distance
number
The distance from point_a to the hit point.
origin
vector3
The starting position of the ray (point_a).
hit_part
instance
The object or part that was hit by the ray. nil if hit is false.
hit_point
vector3
The position where the ray intersected the object. nil if hit is false.
raycast send(point_a, point_b, ignore) -> result_table
Casting an invisible ray from a vector3 in a specified direction with a set length. After you caste the ray, you can detect if it intersects with a basepart.
point_a
vector3
The starting position of the ray.
point_b
vector3
The ending position of the ray.
ignore
table
A list of instances that should be ignored by the raycast.
raycast setnext_ray_debug() -> void
Enables visual debugging for the next raycast.
When this function is called, the next raycast performed will be displayed visually (e.g., as a line in the environment).
This is useful for troubleshooting and verifying the raycast's behavior.

raycast clear_logs() -> void
Clears all debug logs generated by setnext_ray_debug.
Removes any visual representations or logged information created during debugging.
Example
Last updated