How to make Raycast visible?

How do I make this raycast for my gun visible? Like I want to make it visible to have a bullet line when the gun fires.

Code:

local hitObject, bulletPos = RayCast(Handle.Position, shootDirection, Range)
local bullet

			-- Create a bullet here
			local hitObject, bulletPos = RayCast(Handle.Position, shootDirection, Range)
			local bullet
			-- Create a bullet here
			if hitObject then
				bullet = CreateBullet(bulletPos)

You cannot directly have the raycast visible but you can create a part to represent how it looks like through the formula below:

1 Like